Set standard handles explicitly when starting a process with `-NoNewWindow` by daxian-dbw · Pull Request #25061 · PowerShell/PowerShell
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 8.2k
Conversation
PR Summary
Fix #24986
This is a follow-up fix to the changes introduced by #20853.
- If we are starting a process with a new window, we should leave the standard handles unset when they are not redirected and let Windows figure out the default to use creating the process. Otherwise, the standard input of the new window will be tied with the old window for some reason and causes the new window to be unusable.
- If we are starting a process re-using the current window (with
-NoNewWindow), then we need to explicitly set all the standard handles, especially when any of them is redirected. Otherwise, the un-redirected handles will become invalid.
PR Checklist
- PR has a meaningful title
- Use the present tense and imperative mood when describing your changes
- Summarized changes
- Make sure all
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright header - This PR is ready to merge and is not Work in Progress.
- If the PR is work in progress, please add the prefix
WIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.
- If the PR is work in progress, please add the prefix
- Breaking changes
- None
- OR
- Experimental feature(s) needed
- Experimental feature name(s):
- User-facing changes
- Not Applicable
- OR
- Documentation needed
- [ ] Issue filed:
- Testing - New and feature
- N/A or can only be tested interactively
- OR
- Make sure you've added a new test if existing tests do not effectively test the code changed
- Tooling
- I have considered the user experience from a tooling perspective and don't believe tooling will be impacted.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters