Opened 5 years ago

#9916 new bug

ghc -e ":foo bar" exit status is inconsistent

Reported by: rwbarton Owned by:
Priority: low Milestone:
Component: GHCi Version: 7.8.3
Keywords: Cc: hvr
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: #7962, #9905 Differential Rev(s):
Wiki Page:


Since #7962 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.)

Change History (0)

Note: See TracTickets for help on using tickets.