Repository navigation
Add Get-Help help to every public function - #16
Merged
Merged
Conversation
Invoke-PkProcessWithTimeout (overrun or abort) and the dispatcher's force-stop after an abort called Process.Kill(), which ends only the program itself. Anything it started kept running, holding its output open, until the script exited. They now use Stop-PkProcessTree, like the batch timeout already does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each public function's comment block was plain comments, so Get-Help showed only its syntax and the README said to read the file instead. All 21 public functions now have comment-based help: a synopsis, description, every parameter with its default, what it returns, and an example for the main ones. Notes meant for maintainers stay as plain comments after the help. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When a script dot-sourced the kit and was run from a prompt
(.\script.ps1 or & script), the kit's functions existed only in that
script's scope. A .GetNewClosure() block can only see global functions,
so Invoke-PkProcessBatch - whose internal callbacks are closures -
failed every command ("Start-PkProcess is not recognized"), and so did
any caller closure that called a kit function. Under powershell -File it
worked, which is how every test ran, so this went unnoticed since v1.0.
The kit now also defines each of its functions globally when loaded.
README: notes the global functions, and that a closure can't call the
script's own functions when run from a prompt unless they're global.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The export walked every function in the file the kit's code sits in, so a script that pasted the kit in had its own functions made global, and one defined after the kit caused a 'Cannot find path' error at load (fatal under strict mode). The loop also ran in the caller's scope, overwriting and removing two of its variables. It now only exports Pk-named functions and Initialize-ParallelKit, from a child scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The force-stop after an abort ran taskkill once per job, waiting for each before the next, which added seconds with many programs still running. Stop-PkProcessTree now takes several processes and kills all their trees in one taskkill call; the dispatcher's force-stop and teardown paths use that through Stop-PkJobProcesses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…comment-based-help
…cessTree Brings in the process-tree kill changes and the global functions so the help describes the behaviour they add: Stop-PkProcessTree takes several programs, and Invoke-PkProcessWithTimeout / the dispatcher's force-stop kill a program's children too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…artly fails With several PIDs, taskkill exits non-zero if any one was already gone (it exited a moment before, or was taken by another listed tree), even though it killed the rest, so the call returned $false. It now counts the call as having killed them if any listed process is gone afterwards. The race itself can't be set up on demand in the harness; a new assertion covers a parent and its child passed together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…/comment-based-help
# Conflicts: # ParallelKit.ps1
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. Each public function was documented only in plain comments at the top of its definition, so
Get-Helpshowed just its syntax. The README told people to read the file instead.What changed. All 21 public functions now have comment-based help:
It's written as
# .SYNOPSIS-style line comments, matching the file's existing comment style. Notes meant for maintainers stay as plain comments after the help block. The README now points toGet-Help <function> -Full.The set of public functions is the 21 the README documents. Internal helpers (
Invoke-PkProcessDispatchCore,Resolve-PkEncodingand so on) are left without help.Testing. A new harness assertion checks that every public function has a real synopsis and a description for each of its parameters, via
Get-Help. It caught one block the help parser rejected outright: a line starting with.NETreads as an unknown help keyword. 218 assertions pass on Windows PowerShell 5.1 and PowerShell 7.6. It merges cleanly with #13 and #15.🤖 Generated with Claude Code