[GHC] #12475: GHCi no longer handles stdin being closed gracefully

GHC ghc-devs at haskell.org
Mon Aug 8 07:23:04 UTC 2016


#12475: GHCi no longer handles stdin being closed gracefully
-------------------------------------+-------------------------------------
           Reporter:  rowanblush     |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  GHCi           |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 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.

 {{{
 #!sh
 [rowanblush at 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 at 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 at 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 at 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 at coquelicot:~]
 +$
 }}}

 (1):
 https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci.html
 #faq-and-things-to-watch-out-for

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12475>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list