Repository navigation
Add OnStart and opt-in KillOnCancel - #88
Open
ShalokShalom wants to merge 1 commit into
Open
ShalokShalom wants to merge 1 commit into
ShalokShalom wants to merge 1 commit into
Conversation
OnStart reports the process id as soon as a command starts, for supervisors that need the pid before completion. KillOnCancel makes async cancellation kill the child process tree and return exit 124 instead of orphaning it. Adds builder operations for both Shell and Exec contexts, tests and documentation.
This was referenced Nov 29, 2026
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.
Summary
Adds two opt-in builder operations for both
ShellandExeccontexts:OnStart (int -> unit)reports the process id as soon as the process starts, so a supervisor can track it before the command finishes.KillOnCancel truechanges async cancellation from abandoning the child to killing the process tree and returning anOutputwithExitCode = 124andError = "operation cancelled".Default behaviour is unchanged. Without
KillOnCancel, cancellation still throws as before.Motivation
Command.executeAsyncwaits withWaitForExitAsync(cancellationToken), but on cancellation it did not kill the child. In a watchdog that is fatal: a cancelledsleep 30survived and was reparented to init. A supervisor needs both the PID early and a way to make cancellation actually terminate the process tree.Verification
dotnet test src/Fli.Tests/Fli.Tests.fsproj -c Release— 67 passed, 0 failed onnet10.0.sleep 30with a 1s budget, asserts exit code 124, matching PID, and that the child is gone.Stack
PR 1 of 3. The following PRs add property-based tests and toolchain updates on top of this change.