-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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+D (EOF) input doesn't close a WSL terminal #4223
Comments
This is the new implementation of "defaults": {
"closeOnExit": "always"
}, Another problem is that it is not possible to close the tab with the keyboard when the error you describe occurs, at least I couldn't find any. But maybe that needs a separate issue. |
We haven’t had any trouble with Ctrl+Shift+W after the connection closes unexpectedly. We are still evaluating to see whether this ( |
Alright! This one is just by design. Sorry.
It looks like a shell terminated with
Terminal (and any other terminal emulator that supports this, like iTerm2 on macOS or ConEmu or ...) has no way of knowing that the "failed" exit code was, in fact, one propagated out of the process on somebody else's behalf. |
As far as workaround: |
And as a final note, the test above was performed on actual Linux. 😀 |
Thanks, the "always" option seems to yield the expected result always. Also, running the same test as above on a native Ubuntu 18.04 yields the same result as well, the terminal is immediately closed on Ctrl+D. |
The native Ubuntu terminal does not do process exit code detection by default. Because of this, if your shell is misconfigured it will open, print out a heap of text, and then close without letting you see it. It looks like it's configurable. If you set this... to Hold the terminal open, you get this -- even if you use (I did use We chose to hold the terminal open by default as we think it's a better experience. |
My bad, sorry for that noise 😕 |
@DHowett-MSFT Would it be possible to add an explanation message when this happens? It's the default behavior on WSL and it's quite confusing to see a tab stay open with an error. I couldn't figure whether something was wrong with WSL, bash, or the terminal app. |
If we could detect that there was an exit code caused by the user pressing Ctrl+D, we would have circumvented the message entirely and closed the window 😄 |
Environment
Steps to reproduce
Expected behavior
Terminal window (or tab) is closed as if the
exit
command was given.Actual behavior
Terminal prints a new line and then
[process exited with code 127]
(the number being the previous command's exit code), and finally an input prompt on the same line, but no text input is accepted. Terminal session is halted and doesn't accept input (surrounding UI and new tabs do work).I believe this behavior is new in the 0.8... version and didn't exist in the previous official preview release. Running the same WSL environment via cmd.exe also behaves as expected, immediately closing the command line after entering the EOF code.
Also in other exit code cases (such as giving Ctrl+D directly to a fresh terminal), Windows Terminal exits as expected.
Visual example:

The text was updated successfully, but these errors were encountered: