-
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
exit doesn't reliably close the tab #5214
Comments
I was going to give the usual
But then after re-reading, it seems peculiar to me that this would happen sometimes and not other times. Maybe the process that's run immediately prior to |
This comment has been minimized.
This comment has been minimized.
Entering a nonexistent command then typing exit yields code 9009. I believe Terminal's broadly incapable of picking up somebody else's exit code -- it's holding a process handle for CMD, after all 😄 |
Ah. Exit codes indeed. Trying to run a nonexistent command and then type exit gives 9009. Typing "where asdfasdf" and then typing exit gives exit code 1. And so on. "where asdfasdf" followed by "where notepad" followed by "exit" works (closes the tab) |
I came here to search in regards to this one, as have been getting this for a little bit, just as "randonascii" puts it. I am not sure if this is normal or not, I am trying just now to read up on the "closeOnExit" stuff. A little over my head on the exit codes, but will figure out. I'll leave it in other's very capable hands! |
Okay, I figured it out, found the resources online. Looks like exit codes can be used to evaluate the state that a run program exited as, maybe good for scripting. I just didn't know. Obviously you do, just saying ;) But yeah, seems like exiting via 'exit' when %ErrorLevel% != 0, then you get stuck with that error message, and you cannot break out of to close the terminal with the command line. You can still close the tab via clicking the X. To the original poster, looks whatever you last did before trying to exit triggered a 'code 2': |
I plan to tell people that this command sequence guarantees a clean exit: cmd.exe /c echo ExitOnError=1 >%temp%\errorhandler.val && exit It's true, and also deliciously misleading. Vaguely related: twice I've seen a command prompt exit and print: [process exited with code 1] This is without my typing exit. I guess it has crashed? |
Using |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Usually I don't get exit codes to exit the tab. This time I did and got this interop error. It's working better than before at least (wsl.conf wasn't being read and interop was completely dead before unless I manually mounted my Windows drives in the CLI). Using an imported distro is more painful than one would think. |
Can we have the window close no matter what the code is? I've got an SSH client as one of my shells that connects to a machine and when I type "bye" on the remote machine, my window always says [process exited with code 4294967295] and won't close. I honestly don't care about the code. Just close the window. How can we do that? (EDIT: Changed so that people don't think I'm patronizing) |
Yeah, you can. Set |
You do not need to be patronizing to make your point. (EDIT: It is possible I read "Just close the window. Can we do that?" in a way the author did not intend.) |
Yeah, wasn't trying to be patronizing. Just didn't know about the always option. Weird that you can set a field to either true or false, or a string value. Just my opinion, I think "always" would be the preferred default option for most people. I've been a Windows user and software developer for over 25 years and couldn't think of a single instance in that time I wanted to know what exit code a shell or program closed with. I'm sure there's reasons people would want it, but just seems unnecessary by default. Thanks for the quick response, though. :) |
So, the main thing we were combatting is shells exiting immediately on open; it was one of the huge perceived reliability issues in versions pre-0.5 that was largely out of our control. We’ve got a plan on the books to make it more like ConEmu and only show you the message if the process eats it within five seconds of launching, but that one didn’t make the cut for 1.0. Sorry for being so trigger-happy to call you out. 😄 |
(If you’re coming from a version of Terminal settings where closeOnExit is a Boolean value, it might be a great time to refresh your settings by moving them aside and letting us regenerate the file. The new defaults are a lot more sane than the old ones, but they might also change some things you’re relying on. YMMV.) |
Perhaps related: a couple of times a cmd window in the Windows Terminal (Preview) has spontaneously printed "[process exited with code 1]" without me typing exit. This seems to happen when I'm not even interacting with it. It feels like it has just randomly quit. I have WER configured to get crash dumps and I haven't seen any so I don't know what's going on. It doesn't seem worth filing a bug because I have no real information, but I thought I'd mention it here. |
Huh.. that could be a crash in the PTY host. Would you mind keeping your eyes peeled for OpenConsole dumps? This could be one of our known issues if it’s related to resizing (which I can’t immediately evoke by name on my phone.) |
@Firehawke We should definitely track that one as a separate issue! Would you mind capturing a dump file from Task Manager (WindowsTerminal.exe process) when it's hung like this? You can e-mail me with the address on my GitHub profile. |
Okay, I'll open a new issue as soon as I'm able to trigger it again. |
This also happens for me. I can reliably reproduce it with WSL (Ubuntu).
|
@raxraj as mentioned earlier in this thread:
You can also just set |
For those that may not know, |
@HolisticDeveloper @zadjii-msft Thanks, I understood. Solved the problem :) |
That's fair. The message should say "the root process, wsl.exe, exited and reported an error code. everything underneath it has been either terminated or detached from the console". Sorry, that's the best explanation we can give. 😄 |
Well, this explanation is way better than the message that I got just minutes ago. At least it'd be clear that WSL is dead and that I should close the tab. I thought some WSLv1 process (like Ubuntu's command_not_found that loads up python and does search for modules in a gazillion of site locations) got hung so badly that doesn't respond to Ctrl+C and blocked the WSL instance. |
Not to beat a dead horse but check the docs:
Cheers, |
Yep, that's exactly the same as all the other hits in this thread. You can totally avoid it with |
Sometimes it exits and closes the tab, sometimes not. When it doesn't close the tab (because of whatever non-zero code or another reason), I propose it should print some clear explanation what process is talked about and why the tab isn't closed automatically so that I don't have to google it another time when it happens in a few months... |
I've read that closeOnExit is a profile especific feature. Seems not anymore, I've edit the settings.json and defined the setting in general (not inside the profiles part) and worked. That should be default behavior. |
You will probably find, next time you Save your settings using the UI, that it deletes that key from the general section. It is not expected there, and it will be ignored. :) |
Environment
Steps to reproduce
Use terminal preview for a while, then type exit to close the current tab
Expected behavior
The tab closes. This happens sometimes, particularly on a recently opened tab that hasn't been used much
Actual behavior
A "process exited" message is printed but the tab remains.
c:\src>exit
[process exited with code 2]
I don't know what triggers this - I cannot repro it on demand. I'll watch for it.
The text was updated successfully, but these errors were encountered: