Repository navigation
feat(process): let the host choose how the supervisor stops - #219
Merged
Merged
Conversation
A session-end stop on Windows must not launch the Ctrl+C shutdown helper, because new processes fail to initialize while the session is torn down. Hosts inject an Arc<AtomicStopStrategy> at build time and store Kill before cancelling; both Supervisor::stop and cascading cancellation read it when they stop. Without a strategy the behavior is unchanged. Refs libnyanpasu/clash-nyanpasu#6054
Changed Files
|
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.
Implements the stop strategy from the review on #218 (which is closed in favor of this narrower change).
#[atomic_enum] StopStrategy { Graceful, Kill }andSupervisorBuilder::stop_strategy(Arc<AtomicStopStrategy>).Supervisor::stopand the cascading cancellation branch bothload(Acquire)the strategy at stop time and pass it tostop_process;Killcallskill()directly, so no Ctrl+C shutdown helper is launched.Kill(Release) before cancelling; without a strategy the behavior is unchanged.Command, the engine, or backoff.Tests (
tests/process_supervisor.rs): Kill throughstop()and through parent-token cancellation reaps the child and grandchild and observes a strategy stored after build; on Windows a marked helper is asserted not launched for Kill and launched for Graceful; default and explicit Graceful keep the graceful path.Verified on Linux: fmt, clippy
-D warnings,cargo test --all-features, docs, andcargo +nightly check --target x86_64-pc-windows-gnu --all-features --tests. Not yet run on Windows:process_supervisor/process_kill/process_helper_smokefor the Kill path still need a Windows run.Refs libnyanpasu/clash-nyanpasu#6054