"cmd.exe" does not exit the terminal properly if the last command didn't exit with 0 #18261

Closed
opened 2026-01-31 06:08:26 +00:00 by claunia · 6 comments
Owner

Originally created by @dovholuknf on GitHub (Aug 22, 2022).

Windows Terminal version

1.14.1963.0

Windows build number

No response

Other Software

cme.exe - whatever comes with windows 11 latest

Steps to reproduce

  • set windows terminal preview as the default terminal application and save that setting
  • hit the start key
  • type: cmd.exe [enter] (to open "Command Prompt - App")
  • type: type bob
  • i expect you'll see: "The system cannot find the file specified."
  • type: exit

Expected Behavior

the terminal should exit

Actual Behavior

the terminal stays alive indicating:

C:\Users\user_name>exit

[process exited with code 1 (0x00000001)]
Originally created by @dovholuknf on GitHub (Aug 22, 2022). ### Windows Terminal version 1.14.1963.0 ### Windows build number _No response_ ### Other Software cme.exe - whatever comes with windows 11 latest ### Steps to reproduce * set windows terminal preview as the default terminal application and save that setting * hit the start key * type: cmd.exe [enter] (to open "Command Prompt - App") * type: type bob * i expect you'll see: "The system cannot find the file specified." * type: exit ### Expected Behavior the terminal should exit ### Actual Behavior the terminal stays alive indicating: ``` C:\Users\user_name>exit [process exited with code 1 (0x00000001)] ```
claunia added the Issue-BugResolution-Duplicate labels 2026-01-31 06:08:27 +00:00
Author
Owner

@DHowett commented on GitHub (Aug 22, 2022):

Thanks for the report! This has been fixed as of 1.15 builds 200x+. /dup #13325.

@DHowett commented on GitHub (Aug 22, 2022): Thanks for the report! This has been fixed as of 1.15 builds 200x+. /dup #13325.
Author
Owner

@ghost commented on GitHub (Aug 22, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Aug 22, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@dovholuknf commented on GitHub (Aug 23, 2022):

image

the steps to report a bug are incorrect if you're using the terminal preview. turns out i am running 1.15.2003.0 and the bug is most definitely still present

@dovholuknf commented on GitHub (Aug 23, 2022): ![image](https://user-images.githubusercontent.com/46322585/186146746-f3ee394a-fd2e-4c42-96d1-f65e4093a14c.png) the steps to report a bug are incorrect if you're using the terminal preview. turns out i am running 1.15.2003.0 and the bug is most definitely still present
Author
Owner

@dovholuknf commented on GitHub (Aug 23, 2022):

@DHowett - would you mind reopening/retriaging this bug? or i can just file another if i have to?

@dovholuknf commented on GitHub (Aug 23, 2022): @DHowett - would you mind reopening/retriaging this bug? or i can just file another if i have to?
Author
Owner

@zadjii-msft commented on GitHub (Aug 23, 2022):

Sorry, more correctly, this is fixed in Preview v1.15.228, which should also be appearing by default on some set of stable builds also, but those haven't been spun up quite yet.

It's enabled by a small change to the closeOnExit setting, which might have already been persisted as graceful in your settings. After #13560 is released, the new default should be automatic, which will do what you want. Till then, you can use closeOnExit: always

@zadjii-msft commented on GitHub (Aug 23, 2022): Sorry, more correctly, this is fixed in `Preview v1.15.228`, which should also be appearing by default on some set of stable builds also, but those haven't been spun up quite yet. It's enabled by a small change to the `closeOnExit` setting, which might have already been persisted as `graceful` in your settings. After #13560 is released, the new default should be `automatic`, which will do what you want. Till then, you can use `closeOnExit: always`
Author
Owner

@dovholuknf commented on GitHub (Aug 23, 2022):

Good grief - I had found/used closeOnExit": "always" for other profiles but didn't apply it to 'defaults"... Which i just rectified, thanks!

        "defaults": 
        {
            "closeOnExit": "always",
            ...
            ...
@dovholuknf commented on GitHub (Aug 23, 2022): Good grief - I had found/used `closeOnExit": "always"` for other profiles but didn't apply it to `'defaults"`... Which i just rectified, thanks! ``` "defaults": { "closeOnExit": "always", ... ... ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#18261