Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stack repl exits on ctrl+c with error <stdin>: hGetChar: hardware fault (Input/output error) #3821

Closed
kindaro opened this issue Jan 29, 2018 · 3 comments

Comments

@kindaro
Copy link

kindaro commented Jan 29, 2018

General summary/comments (optional)

stack repl terminates when I repeatedly press ctrl+c. Two times is enough. Termination is observed on each of 5 consecutive runs. If there is other activity between the ctrl+c presses, still terminates on the second ctrl+c.

In the same situation, stack exec ghci does not terminate.

There is an error log in the gist.

This issue elsewhere may be related, as the error is the same.

Steps to reproduce

% stack repl
λ {- repeatedly press ctrl+c -}
% <stdin>: hGetChar: hardware fault (Input/output error)
%

Expected

A new clear prompt is offered, the same as with stack exec ghci.

Actual

stack repl terminates, an error is printed to stderr.

Stack version

% stack --version
Version 1.7.0, Git revision 2631803b9c502fa5225eac3536acda9d1d314aa7 (5619 commits) x86_64 hpack-0.20.0

Method of installation

ArchLinux AUR haskell-stack-git

@tswelsh
Copy link
Contributor

tswelsh commented Feb 13, 2018

I also see this on Version 1.7.0, Git revision 0d848deac8e541aa40c5ab5bc784bb9d3ec2928a x86_64 hpack-0.20.0. I'm debugging a very slow test and need to kill the running test with Ctrl+c very often, but with this bug I have to restart things constantly, making it not really feasible to use.

@mgsloan
Copy link
Contributor

mgsloan commented Feb 16, 2018

Good catch! I've noticed this too, but didn't realize that stack exec ghci had better behavior. It'd been a long time since I used plain old ghci so forgot that it worked better for spamming Ctrl-C. I've implemented some changes that fix this, in #3869

To make it happen, it needed to leave around the generated files. This has the nice consequence that if you do stack ghci -v, and then exit the process, you can copy paste the ghci invocation out. It has the downside of potentially creating garbage, but it's stored in /tmp and is based on hashes. So, it only writes out new files if the contents have changed. So, running stack ghci multiple times in a row shouldn't create any new files.

@snoyberg
Copy link
Contributor

PR #3869 has been merged into master, so this should now be resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants