Tab remains open even on process exit #13164

Closed
opened 2026-01-31 03:35:23 +00:00 by claunia · 5 comments
Owner

Originally created by @rashil2000 on GitHub (Mar 24, 2021).

Windows Terminal version (or Windows build number)

10.0.19042.870 1.7.572.0

Other Software

No response

Steps to reproduce

This doesn't happen each time, but it does happen often enough to be annoying - leading me to file this issue.

Shell is mostly irrelevant - I use a variety of them - CMD, Powershell, Powershell Core, Msys Bash, Msys Zsh, WSL1/2, SSH sessions etc.

Open a shell. Do some work. Exit it with Ctrl+D. (This is a fairly preferred way of closing a shell without typing 'exit' or reaching for the mouse to close the tab)

Expected Behavior

The tab to get closed.

Actual Behavior

This happens instead (screenshot below):

The tab remains open.

image

Originally created by @rashil2000 on GitHub (Mar 24, 2021). ### Windows Terminal version (or Windows build number) 10.0.19042.870 1.7.572.0 ### Other Software _No response_ ### Steps to reproduce This doesn't happen _each_ time, but it does happen often enough to be annoying - leading me to file this issue. Shell is mostly irrelevant - I use a variety of them - CMD, Powershell, Powershell Core, Msys Bash, Msys Zsh, WSL1/2, SSH sessions etc. Open a shell. Do some work. Exit it with `Ctrl+D`. (This is a fairly preferred way of closing a shell without typing 'exit' or reaching for the mouse to close the tab) ### Expected Behavior The tab to get closed. ### Actual Behavior This happens instead (screenshot below): The tab remains open. ![image](https://user-images.githubusercontent.com/46838874/112283017-b17e3000-8cad-11eb-94f3-cd613adea40f.png)
claunia added the Issue-QuestionNeeds-TriageNeeds-Tag-FixResolution-Answered labels 2026-01-31 03:35:23 +00:00
Author
Owner

@skyline75489 commented on GitHub (Mar 24, 2021):

When the return code of the process is 1 instead of 0, this is expected.

You can find out more in the documentation about closeOnExit.

See also #4223, #5003.

@skyline75489 commented on GitHub (Mar 24, 2021): When the return code of the process is 1 instead of 0, this is expected. You can find out more in the documentation about closeOnExit. See also #4223, #5003.
Author
Owner

@zadjii-msft commented on GitHub (Mar 24, 2021):

Thanks for the report! Please make sure to search for duplicates when filing new issues. Like skyline75489 mentioned, this is by-design for the closeOnExit setting.

@zadjii-msft commented on GitHub (Mar 24, 2021): Thanks for the report! Please make sure to [search for duplicates](https://github.com/microsoft/terminal/issues?q=is%3Aissue+%22process+exited+with+code%22) when filing new issues. Like skyline75489 mentioned, this is by-design for the [`closeOnExit`](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/profile-advanced#profile-termination-behavior) setting.
Author
Owner

@rashil2000 commented on GitHub (Mar 24, 2021):

Thanks for the link @zadjii-msft!

The reason I filed a new issue was because of a possible resolution I had in mind (apart from modifying closeOnExit behavior, obviously, as @skyline75489 mentioned) - namely - having a keybind that closes a tab. I searched for that and couldn't find anything in the issues, hence a new one. Would you mind reopening this if such a feature doesn't exist?

@rashil2000 commented on GitHub (Mar 24, 2021): Thanks for the link @zadjii-msft! The reason I filed a new issue was because of a possible resolution I had in mind (apart from modifying `closeOnExit` behavior, obviously, as @skyline75489 mentioned) - namely - having a keybind that closes a tab. I searched _for that_ and couldn't find anything in the issues, hence a new one. Would you mind reopening this if such a feature doesn't exist?
Author
Owner

@zadjii-msft commented on GitHub (Mar 24, 2021):

closePane will close the tab if there's only one pane in the tab. That's why it's the action bound to ctrl+shift+w by default.

There's also a closeTab action, which will close the tab even when multiple panes are open.

@zadjii-msft commented on GitHub (Mar 24, 2021): [`closePane`](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions#close-pane) will close the tab if there's only one pane in the tab. That's why it's the action bound to <kbd>ctrl+shift+w</kbd> by default. There's also a [`closeTab`](https://docs.microsoft.com/en-us/windows/terminal/customize-settings/actions#close-tab) action, which will close the tab even when multiple panes are open.
Author
Owner

@rashil2000 commented on GitHub (Mar 24, 2021):

Okay, thanks for the help!

@rashil2000 commented on GitHub (Mar 24, 2021): Okay, thanks for the help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13164