[PR #16497] [CmdLineArgs] "--keepOpen" to keep the window/tab/pane open after the process/profile has exited. #30933

Open
opened 2026-01-31 09:43:54 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/16497

State: closed
Merged: No


Summary of the Pull Request

Adding a parameter to wt.exe that stops WT from closing after the sub process has exited.

References and Relevant Issues

Detailed Description of the Pull Request / Additional comments

This PR add the command line argument --keepOpen (short: -o) that stops WT from closing after the sub process has exited. This is done by overriding the Profile termination behavior setting at runtime with Never.

The new parameter is implemented as new-tab parameter and supports to be written to/read from a command line arguments JSON file.

Validation Steps Performed

  • Tested that the new parameter is recognized on long and short form.
  • 🔲 Tested that the new parameter stops WT from closing regardless of the current setting choice.
  • 🔲 Tested that the new parameter not changes the setting permanently.
  • Tested that the net tests succeed. => Added, but all command line tests are failing.
  • 🔲 Tested the following parameter cases:
Command line Result Reason
wt.exe --keepOpen ping.exe learn.microsoft.com
wt.exe --keepOpen cmd.exe /c echo "test"
wt.exe -o cmd.exe /c echo "test"
wt.exe new-tab --keepOpen PowerShell -c Get-Service
wt.exe nt -p "Command Prompt" --keepOpen
wt.exe nt -p "PowerShell" --keepOpen
wt.exe nt -p "Windows PowerShell" -o
wt.exe -p "Command Prompt" ; split-pane -p "PowerShell" --keepOpen
wt.exe -p "Command Prompt" ; split-pane -p "PowerShell" -o
wt.exe --keepOpen -p "Command Prompt" ; split-pane -p "PowerShell"
wt.exe new-tab --keepOpen PowerShell --appendCommandLine -- Write-Host test
wt.exe new-tab -o PowerShell --appendCommandLine -- Write-Host test

PR Checklist

**Original Pull Request:** https://github.com/microsoft/terminal/pull/16497 **State:** closed **Merged:** No --- ## Summary of the Pull Request Adding a parameter to wt.exe that stops WT from closing after the sub process has exited. ## References and Relevant Issues ## Detailed Description of the Pull Request / Additional comments This PR add the command line argument `--keepOpen` (short: `-o`) that stops WT from closing after the sub process has exited. This is done by overriding the `Profile termination behavior` setting at runtime with `Never`. The new parameter is implemented as new-tab parameter and supports to be written to/read from a command line arguments JSON file. ## Validation Steps Performed - ✅ Tested that the new parameter is recognized on long and short form. - 🔲 Tested that the new parameter stops WT from closing regardless of the current setting choice. - 🔲 Tested that the new parameter not changes the setting permanently. - ❌ Tested that the net tests succeed. => Added, but all command line tests are failing. - 🔲 Tested the following parameter cases: Command line | Result | Reason | ------------ | ------------- | ------------- | `wt.exe --keepOpen ping.exe learn.microsoft.com` | ❌ | `wt.exe --keepOpen cmd.exe /c echo "test"` | ❌ | `wt.exe -o cmd.exe /c echo "test"` | ❌ | | | | `wt.exe new-tab --keepOpen PowerShell -c Get-Service` | ❌ | `wt.exe nt -p "Command Prompt" --keepOpen` | ❌ | `wt.exe nt -p "PowerShell" --keepOpen` | ❌ | `wt.exe nt -p "Windows PowerShell" -o` | ❌ | | | | `wt.exe -p "Command Prompt" ; split-pane -p "PowerShell" --keepOpen` | ❌ | `wt.exe -p "Command Prompt" ; split-pane -p "PowerShell" -o` | ❌ | `wt.exe --keepOpen -p "Command Prompt" ; split-pane -p "PowerShell"` | ❌ | | | | `wt.exe new-tab --keepOpen PowerShell --appendCommandLine -- Write-Host test` | ❌ | `wt.exe new-tab -o PowerShell --appendCommandLine -- Write-Host test` | ❌ | ## PR Checklist - [x] Closes #16060 - [ ] Tests added/passed => Added, but not passed. - [x] Documentation updated - If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: [#784](https://github.com/MicrosoftDocs/terminal/pull/784) - [x] Schema updated (if necessary)
claunia added the pull-request label 2026-01-31 09:43:54 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#30933