Repository navigation
Conversation
3 of 6 tasks
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Stacked on #64902. Fixes the cases it lists as not covered.
Type of change
What does this PR do?
#64902 keeps the children of a Store app in the pipe job when the daemon starts the Store app itself. Windows still lets two kinds of process leave the job, and then cancelling or timing out a command, or a daemon crash, leaves them running:
pwsh,wsl.exeorwinget.exerun bycmd.exeor another shell. Windows moves it into its package's own job. Ours can't take it back (AssignProcessToJobObjectfails with access denied).pwshstarted by Storepwsh: the inner one stays in the job, but its children don't, because the desktop-app policy only reaches the daemon's own child.Windows has no way to prevent either, so this adds a watcher (
src/service/pipe/windows/tree.rs):A snapshot takes about 4 ms here (around 360 processes). At one poll a second that's about 0.4% of a core while commands run. That's why it doesn't poll faster.
The PTY path needs nothing: a Store
pwshterminal behaves like one running regularpwsh. Closing it kills everything attached to the console, and processes with their own console survive with either shell. That's normal terminal behaviour (socode .survives closing the tab), so I left it alone.No flag: this is a fix in the daemon's kill path.
How did you verify your code works?
On Windows 11 with Store PowerShell 7.7.0:
tree.rsrun on CI without Store apps. They fake an escaped child by creating it with the root as its parent (PROC_THREAD_ATTRIBUTE_PARENT_PROCESS) before the root joins the job, then check that:tests/pipe_windows.rs, which return early on CI:cmd.exe→ Storepwsh→ping, killed;pwsh→ Storepwsh→ping, killed;pingis put back in a job;cmd.exestarted in the background.tests/windows-daemon.rskills the real daemon process after adoption and checks that the nested Storepwshand itspingdie with it.signal_reaches_a_grandchild_of_store_powershellstill passes.cargo fmt --check,cargo clippy --all-targets --all-features -- -D warningsandcargo test --all-targets --all-featurespass. The library, Windows pipe and daemon-crash tests passed 8 times in a row.Screenshots / recordings
Not a UI change.
Checklist