-
Notifications
You must be signed in to change notification settings - Fork 701
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
Ctrl-C kills cabal repl on windows #8820
Comments
Thanks for the report and a lot of datapoints! Thoughts. Looks relevant: #8208, where they say that the bug may have been introduced in #7921 Suggestions:
|
As far as I understand, #7921 didn't make it into cabal 3.6 (or even cabal 3.8), so it's unlikely to be the cause here. It should be in that 3.9 pre-release though, and might even help here judging by the PR description, since I claim it improves Ctrl-C behaviour on Windows 😅. I think #7929 is the only one of my somewhat related changes that is in Cabal 3.8, but that shouldn't interfere. It would be interesting to know if/when this ever worked on Windows -- the thing that's involved on the Unix side is |
Sure, here are my results. cabal 3.8.1.0 and pre-release cabal 3.9.0.0:Same problem, but if I run
Inside a project it does exit the repl but without printing anything. The provided command for the "internal" prerelease does not work for me, I also tried to replace cabal 3.7.0.0 55e036aSame as 3.8.1.0 and 3.9.0.0 cabal 3.7.0.0 0184445Same as 3.8.1.0 and 3.9.0.0 |
I just tested the following cabal version with ghcup and all of them exit the repl:
|
Awesome, thank you! Not a regression then, "just" one of the bugs around Windows subprocess handling. Here's one instance where this was fixed for I was going to suggest extending
|
hmm thanks for the report, i just tried to reproduce and it worked for me;
I tried cabal-3.9.0.0, not sure which commit but a recent one and cabal-3.8.1.0, using powershell on windows 10 |
I tried this and using
|
@ambroslins sorry about the internal release link mixip: I should have known better than suggesting to get an alpine binary on Windows. Could you try this url instead: |
It might be worth trying across different ghc(i) versions, too. The following seems to work for that (with ghcup-installed ghc versions):
I'm also curious whether there's a difference between |
Same issue.
I tested with ghc 8.8.4, 8.10.7, 9.0.2, 9.2.5, 9.4.4 and all of them have this issue. |
I think the difference is your terminals.. @jneira is trying using a native windows terminal, looks like Powershell. @ambroslins is using what looks like an msys terminal? e.g. bash, sh, zsh etc. If this is the case then it's expected behaviour. Cabal is a Windows program so it throws Windows signals, which are different from Unix signals and the emulated ones in msys processes. We cannot handle both at the same time. you can use |
hmm it is somewhat hidden in the quote but
|
@Mistuke |
Please also see (and verify) #8208 (comment) |
That won't fix it. Sorry finally caught up with the thread. @robx is right that this is a cabal bug. Cabal is handling the signal and not letting the child process do it. |
well it seems to work on my machine but definitely is not a fresh installation, |
I tried it in a Windows 10 VM and having the same issue there. Knowing that it works fine for @jneira I still struggle to find what's wrong on my setup(s). I tried on two different machines (Windows 10 with AMD CPU and Windows 11 with Intel) and a VM with a new ghcup install. Is there some other angle I can try to troubleshoot this? |
Could it depend on the exact moment you hit Ctrl-C? E.g. let's at least agree on which code we try it with. How about just |
I don't think so, I tried a bunch of different functions (including the |
yes, I can reproduce it trivially. The behavior is consistent with cabal handling the signal rather than ghci. i.e. call |
Note that Cabal already sets
process change to make delegate_ctlc cross-platform should be all that's needed.
(There's one path that unsets
(Still confused by how @jneira sees different behavior.) |
I wonder if my reproduction of the hang issue with ctrl c is related, in that case Mistuke does not reproduce it either |
could very well be. I put up a PR for this haskell/process#278 can someone try using this? After the removal of |
I built However, I noticed that if
A repl without an interrupt does exit normally on Also when double pressing |
@ambroslins awesome, thanks for confirming! Hmm that's interesting.. I don't propagate exit codes in the ctrl+c masking. So it's not process passing it on. |
The exit code issue — is it Windows-specific too? |
Process support has been committed |
I think it is, I built the same version as before in WSL and there the exit code is 0. |
I think we can close this issue as it seems to be working properly with recent GHCs:
|
Describe the bug
Using
Ctrl + C
insidecabal repl
(to clear the line or interrupt a long running command) closes the repl on windows.To Reproduce
Ctrl + C
Expected behavior
I expect the repl to stay open after using
Ctrl + C
, asghci
andcabal repl
on WSL stay open after the interrupt.System information
Additional context
I think this is the same as #1448, but I opened as new issue as this is windows specific.
I also tested the commit 9e417fa built with ghc 8.10.7 and 9.2.5, but it has the same problem.
The text was updated successfully, but these errors were encountered: