Repository navigation
Warn when the Job Object can't be set up on first use, or a running program can't be added to it - #83
Merged
Merged
Conversation
…rogram can't be added to it A program's start sets the Job Object up when nothing set it up first, and it dropped the result: a script that never called Initialize-ParallelKit or Invoke-PkRun got no warning when Windows refused, so its programs ran with no cleanup if PowerShell was killed. That setup now goes through the same warning, shown once a session. On the Process.Start path a refused assignment was ignored too. It now warns once, naming the process and Windows' error, but only for a program still running: Windows also refuses one that has already exited. Harness section BG forces both failures, and a missing .NET start lock, through new test hooks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The warning read the shared static LastError, which a start on another thread could change first, and Assign's exception path never set it. A new Assign overload returns the reason for that call: "Win32 error N", or the exception's message when the process can't be read. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What was wrong
Initialize-ParallelKitorInvoke-PkRunbefore it), and it dropped the result. When Windows refused, there was no warning, though the README says the kit warns: programs ran with no cleanup if PowerShell was killed.StartModeAddedToJob), a refused assignment was ignored, so that program ran on unprotected with no word.What changed
Initialize-PkChildProcessJob, warning once a session (it retries on each start after a failure, so it would otherwise warn on every one). The warning goes throughWrite-PkMessage, since a start can be in a worker; the function joins the worker-safe list.TestFailInit,TestFailAssign, andTestNoStartLock(as if .NET's start lock weren't found, the case a future .NET would bring), plusTestResetJobWarnings. C# changed, soTypesVersiongoes to 12.How it was tested
StartModeisAddedToJoband the fallback warns once. Programs still run and return their exit codes in each case.Review follow-up: the warning first read the shared static
LastError, which a start on another thread could change before it was read, andAssign's exception path never set it. A newAssign(process, out reason)overload returns the reason for that one call ("Win32 error N", or the exception's message), and BG checks the exception case with a disposedProcess. Full harness rerun on both: ALL PASSED (605 assertions).🤖 Generated with Claude Code