Providing command-line arguments to a profile makes the terminal crash #13086

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

Originally created by @ClementNerma on GitHub (Mar 18, 2021).

Environment

Windows build number: 19042.868
Windows Terminal version (if applicable): 1.7.572.0

Steps to reproduce

wt -p "PowerShell" # Works

wt -p "PowerShell" pause # Closes immediatly
wt -p "PowerShell" -- pause # Same
wt -p "PowerShell" "-- pause" # Same

Expected behavior

The pause command provided to PowerShell should be executed normally, according to the documentation.

Actual behavior

The window closes immediatly if an additional argument is provided to the selected profile.

Originally created by @ClementNerma on GitHub (Mar 18, 2021). # Environment ```none Windows build number: 19042.868 Windows Terminal version (if applicable): 1.7.572.0 ``` # Steps to reproduce ```bash wt -p "PowerShell" # Works wt -p "PowerShell" pause # Closes immediatly wt -p "PowerShell" -- pause # Same wt -p "PowerShell" "-- pause" # Same ``` # Expected behavior The `pause` command provided to PowerShell should be executed normally, according to the documentation. # Actual behavior The window closes immediatly if an additional argument is provided to the selected profile.
claunia added the Resolution-Duplicate label 2026-01-31 03:33:26 +00:00
Author
Owner

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

Interesting. Could you share your settings? I'm interested on the closeOnExit setting specifically - I'm betting that commandline isn't valid and the connection is closing immediately, which is causing the tab to close immediately, which is then closing the window.

@zadjii-msft commented on GitHub (Mar 18, 2021): Interesting. Could you share your settings? I'm interested on the `closeOnExit` setting specifically - I'm betting that commandline isn't valid and the connection is closing immediately, which is causing the tab to close immediately, which is then closing the window.
Author
Owner

@ClementNerma commented on GitHub (Mar 18, 2021):

Indeed, I set it to closeOnExit: "always". When I remove it, I get an error 0x80070002.

Seems like it's caused by the fact PowerShell cannot launch commands but only executables files directly. When I replace read with cmd.exe everything works fine.

Maybe there could be a quick mention in the docs?

EDIT : That being said running wt -p "<ProfileName>" works fine but wt -p "<ProfileName>" "binary" does not launch the binary inside the requested profile (I get the same error if I put /bin/ls with my WSL profile)

@ClementNerma commented on GitHub (Mar 18, 2021): Indeed, I set it to `closeOnExit: "always"`. When I remove it, I get an error `0x80070002`. Seems like it's caused by the fact PowerShell cannot launch commands but only executables files directly. When I replace `read` with `cmd.exe` everything works fine. Maybe there could be a quick mention in the docs? **EDIT :** That being said running `wt -p "<ProfileName>"` works fine but `wt -p "<ProfileName>" "binary"` does not launch the binary inside the requested profile (I get the same error if I put `/bin/ls` with my WSL profile)
Author
Owner

@DHowett commented on GitHub (Mar 18, 2021):

So, this is more on Terminal’s side. We take the new commandline to be the path to an executable, plus its arguments to be run inside the terminal (incidentally, this is why /bin/ls isn’t valid). There isn’t currently a way to specify “run the thing identified by the profile, but tell it to run the following command”... because the way to do that differs between shells. I believe we have a workitem tracking this. We need to figure out a way to make this possible, as it keeps biting people.

@DHowett commented on GitHub (Mar 18, 2021): So, this is more on Terminal’s side. We take the new commandline to be _the path to an executable, plus its arguments_ to be run inside the terminal (incidentally, this is why /bin/ls isn’t valid). There isn’t currently a way to specify “run the thing identified by the profile, but tell it to run the following command”... because the way to do that differs between shells. I believe we have a workitem tracking this. We need to figure out a way to make this possible, as it keeps biting people.
Author
Owner

@DHowett commented on GitHub (Mar 18, 2021):

(In effect, this replaces the PowerShell profile with one whose entire commandline is “pause”, instead of “powershell -c pause” or something.)

@DHowett commented on GitHub (Mar 18, 2021): (In effect, this replaces the PowerShell profile with one whose entire commandline is “pause”, instead of “powershell -c pause” or something.)
Author
Owner

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

So the "Add support for appending a commandline to a profile's commandline" is trackeed over in #5528. I suppose this thread has generally become a duplicate of that discussion, so we can merge the two.

/dup #5528

@zadjii-msft commented on GitHub (Mar 18, 2021): So the "Add support for appending a commandline to a profile's commandline" is trackeed over in #5528. I suppose this thread has generally become a duplicate of that discussion, so we can merge the two. /dup #5528
Author
Owner

@ghost commented on GitHub (Mar 18, 2021):

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 (Mar 18, 2021): 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!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#13086