Repository navigation
Build the kit as a PowerShell module, and test it that way - #100
Merged
Merged
Conversation
Two of the batch's own closures called Complete-PkProcess and Write-PkMessage by name. A .GetNewClosure() block only sees global functions, so a batch failed with "'Complete-PkProcess' is not recognized" when the kit was loaded for one module only. They're captured up front now, like the private helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker given the function (-SharedFunctionNames takes it) could set a handler made in its own runspace, which the main thread then ran for every message. Running another runspace's scriptblock can hang or crash PowerShell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only looked for an abort after its first 200 ms wait, so a program that finished sooner ran to the end and returned normally, and a slower one ran for about 200 ms before it was killed. It now throws before starting the program, unless -IgnoreAbort is given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… GetNewClosure
DelegateCast missed a scriptblock passed to .NET as ({ 1 }), { 1 }.GetNewClosure(),
[scriptblock]{ 1 } and the like, in the call or through a variable.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Invoke-PkRunspaceJobs is Invoke-PkRunspaceBatch, and 13 private functions lose their plural names. -MaxConcurrent and -AbortTimeoutSeconds are the only names on every engine: -MaxParallel and -DrainTimeoutSeconds are gone. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # README.md
Initialize-ParallelKit loses -MaxConcurrentProcesses and ThreadPool, and the dispatcher its -AbortPollCallback alias. Code nothing reaches goes too. The stale-types message says "a different version". Two functions declare their output type. The comments are shorter and checked against the code. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # ParallelKit.Harness.ps1 # ParallelKit.ps1
Build/New-ParallelKitModule.ps1 makes ParallelKit.psm1 and its manifest from ParallelKit.ps1. The harness can run on that module (-AsModule), and CI runs the sections where loading can matter on it. The README covers the module. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
The kit can now be built as a PowerShell module, for people who'd rather import it than dot-source a file.
ParallelKit.ps1stays the one source, dot-sources as before, and no module files are tracked.What's new
Build/New-ParallelKitModule.ps1makesParallelKit.psm1and its manifest. The.psm1is the.ps1without the wrapper that loads it as an in-memory module: nothing else changes. The manifest's version and function list come from the.ps1. It checks everything before writing anything, so a.ps1whose loading code changed stops it with a message, and the same.ps1always gives the same bytes, on Windows PowerShell 5.1 and PowerShell 7.-AsModule, which builds the module and tests that, imported by name, instead of dot-sourcing.-Section MODULEis the 21 sections where the way it's loaded can matter. CI runs those on the module after the full run, in both jobs (about 85 s each on my machine).What differs from dot-sourcing (all in the README)
-GlobalorRequiredModules, the kit's functions aren't global, so that module's.GetNewClosure()callbacks can't call them.Tests
.ps1refused with nothing written; the manifest's version, functions and identity; eight ways of loading it, each with-Fileand&, with closures and a worker; and a copy with other compiled types refused while the first keeps working. Taking one check out of the generator fails it.Testing/readme-examples/run.ps1passes on both.🤖 Generated with Claude Code