conhost.exe --headless doesn't exit with the child process's exit code. #21619

Open
opened 2026-01-31 07:49:49 +00:00 by claunia · 0 comments
Owner

Originally created by @mjr4077au on GitHub (May 2, 2024).

Windows Terminal version

1.19.10821.0

Windows build number

10.0.22621.3447

Other Software

No response

Steps to reproduce

  1. From a command prompt, run start /wait conhost.exe --headless powershell.exe -Command "exit 1" or start /wait conhost.exe --headless cmd.exe /c "exit 1"
  2. Check the resulting exit code with echo %errorlevel%.

Without routing the above through conhost.exe --headless, %errorlevel% contains the process's exit code as expected.

Expected Behavior

C:\Users\mjr40>start /wait conhost.exe --headless cmd.exe /c "exit 15"

C:\Users\mjr40>echo %errorlevel%
15

C:\Users\mjr40>

Actual Behavior

C:\Users\mjr40>start /wait conhost.exe --headless cmd.exe /c "exit 15"

C:\Users\mjr40>echo %errorlevel%
0

C:\Users\mjr40>

Originally created by @mjr4077au on GitHub (May 2, 2024). ### Windows Terminal version 1.19.10821.0 ### Windows build number 10.0.22621.3447 ### Other Software _No response_ ### Steps to reproduce 1. From a command prompt, run `start /wait conhost.exe --headless powershell.exe -Command "exit 1"` or `start /wait conhost.exe --headless cmd.exe /c "exit 1"` 2. Check the resulting exit code with `echo %errorlevel%`. Without routing the above through `conhost.exe --headless`, %errorlevel% contains the process's exit code as expected. ### Expected Behavior C:\Users\mjr40>start /wait conhost.exe --headless cmd.exe /c "exit 15" C:\Users\mjr40>echo %errorlevel% 15 C:\Users\mjr40> ### Actual Behavior C:\Users\mjr40>start /wait conhost.exe --headless cmd.exe /c "exit 15" C:\Users\mjr40>echo %errorlevel% 0 C:\Users\mjr40>
claunia added the Issue-QuestionNeeds-TriageIssue-BugResolution-Answered labels 2026-01-31 07:49:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21619