ghc -e ":foo bar" exit status is inconsistent
Since #7962 (closed) ghc -e EXPR exits with status code 1 if EXPR fails to compile. While it's undocumented, ghc -e does also accept anything that's valid input to GHCi, including GHCi commands like :t. In this case, the exit code of ghc -e is not always 1 when the command apparently failed. For example, all of:
ghc -e ':t'
ghc -e ':t +'
ghc -e ':t ='
ghc -e ':t x'
ghc -e ':l nonexistentfile.hs'
exit with status code 0. But ghc -e ':l a' exits with status code 1, because a is not a (possible) module name or a source file.
(At the code level, ghc -e ":foo bar" currently exits with status code 1 when the function for :foo raises an exception, and with status code 0 in all other cases.)
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | low |
| Resolution | Unresolved |
| Component | GHCi |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | hvr |
| Operating system | |
| Architecture |