GHCi no longer handles stdin being closed gracefully
It used to be the case that GHCi handled the user closing stdin gracefully, continuing to accept input and restoring stdin on :reload (as is documented in the GHC Users Guide GHCi FAQ (1)). This was the case in 7.6.3, but at least as of 7.8.4 GHCi now dies immediately after printing the prompt following usage of getContents
.
I'm using NixOs version 16.03.1171.9cb194c (Emu). I don't believe this to be a nix- or nixpkgs-related problem, but I don't have any other machines on which to test.
I test 7.6.3, 7.8.4, 7.10.3 and 8.0.1 below.
[rowanblush@coquelicot:~]
+$ nix-shell -p haskell.packages.ghc763.ghc --command "ghci" --pure
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> getContents >> return ()
Prelude> getLine
*** Exception: <stdin>: hGetLine: illegal operation (handle is closed)
Prelude> :reload
Ok, modules loaded: none.
Prelude> getLine
echo
"echo"
Prelude> :q
Leaving GHCi.
[rowanblush@coquelicot:~]
:$ nix-shell -p haskell.packages.ghc784.ghc --command "ghci" --pure
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> getContents >> return ()
Prelude>
<stdin>: hGetChar: illegal operation (handle is closed)
[rowanblush@coquelicot:~]
+$ nix-shell -p haskell.packages.ghc7103.ghc --command "ghci" --pure
GHCi, version 7.10.3: http://www.haskell.org/ghc/ :? for help
Prelude> getContents >> return ()
Prelude>
<stdin>: hGetChar: illegal operation (handle is closed)
[rowanblush@coquelicot:~]
+$ nix-shell -p haskell.packages.ghc801.ghc --command "ghci" --pure
GHCi, version 8.0.1: http://www.haskell.org/ghc/ :? for help
Loaded GHCi configuration from /home/rowanblush/.ghci
Prelude> getContents >> return ()
Prelude>
<stdin>: hGetChar: illegal operation (handle is semi-closed)
[rowanblush@coquelicot:~]
+$
Trac metadata
Trac field | Value |
---|---|
Version | 8.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | GHCi |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |