From d06409c83156283edb4dbcb9a9c3a2d0af1c1037 Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:42:43 -0500 Subject: [PATCH 1/2] Version 4.1 --- ParallelKit.ps1 | 4 ++-- README.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ParallelKit.ps1 b/ParallelKit.ps1 index d1b8e81..9fd2c91 100644 --- a/ParallelKit.ps1 +++ b/ParallelKit.ps1 @@ -2,7 +2,7 @@ # graceful Ctrl+C/window-close handling for Windows PowerShell 5.1 and # PowerShell 7. # -# Version 4.0 - https://github.com/HalRiveria/PowerShell-ParallelKit +# Version 4.1 - https://github.com/HalRiveria/PowerShell-ParallelKit # (Initialize-ParallelKit reports the version too: change both together. The # module's manifest takes it from here.) # Copyright (c) 2026 HalRiveria. MIT License: keep this notice with any copy; @@ -1256,7 +1256,7 @@ function Initialize-ParallelKit { $jobOk = Initialize-PkChildProcessJob # The header's Version line: the version PR changes both, and the harness # checks they match. - $version = [version]'4.0' + $version = [version]'4.1' return [pscustomobject][ordered]@{ AbortHandler = $handlerOk; ChildProcessJob = $jobOk; Version = $version; StartMode = [PkChildProcessJob]::StartMode } } diff --git a/README.md b/README.md index d6721d2..241e49d 100644 --- a/README.md +++ b/README.md @@ -121,7 +121,7 @@ Each one has built-in help: `Get-Help Invoke-PkProcessBatch -Full` shows its par ## Setup -Requires Windows, with Windows PowerShell 5.1 or PowerShell 7. Download `ParallelKit.ps1` from the [Releases page](https://github.com/HalRiveria/PowerShell-ParallelKit/releases) (this README describes version 4.0 and later), put it in your project, and dot-source it from your script: +Requires Windows, with Windows PowerShell 5.1 or PowerShell 7. Download `ParallelKit.ps1` from the [Releases page](https://github.com/HalRiveria/PowerShell-ParallelKit/releases) (this README describes version 4.1 and later), put it in your project, and dot-source it from your script: ```powershell . "$PSScriptRoot\ParallelKit.ps1" @@ -673,7 +673,7 @@ Other pieces: `Request-PkAbort` triggers the same abort from code. `Test-PkAbort - Windows only (console and Job Object APIs), on Windows PowerShell 5.1 or PowerShell 7. - Run it in a PowerShell console window or an editor's terminal (graceful Ctrl+C tested in Windows Terminal, Visual Studio's built-in terminal and VS Code's terminal, including the PowerShell extension's). The Windows PowerShell ISE isn't supported: tested there, the kit loads and runs, but the ISE has no console, so Ctrl+C stops the script outright, with no graceful drain and no cleanup callbacks. -- It needs FullLanguage mode, since it compiles a little C# with `Add-Type` when loaded. On a machine locked down to Constrained Language Mode (usually by AppLocker or Windows Defender Application Control), loading it fails with a message saying so. Some endpoint security products also flag scripts that compile code calling Windows APIs at runtime; if yours blocks the kit, that's the likely reason. +- It needs FullLanguage mode, since it compiles a little C# with `Add-Type` when loaded. On a machine locked down to Constrained Language Mode (usually by AppLocker or Windows Defender Application Control), loading it fails with a message saying so. Some endpoint security products also flag scripts that compile code calling Windows APIs at runtime; if yours blocks the kit, that's the likely reason. On Windows PowerShell 5.1 the compile runs `csc.exe`, which writes a few temporary files to `%TEMP%` and deletes them during the load. And with no logging policy set, PowerShell records the kit as a Warning-level script block logging event (4104) on every load, on 5.1 and 7, because `Add-Type` and the reflection calls are on its built-in list of suspicious words; any script that uses `Add-Type` is logged the same way. - After updating the kit, or changing `ParallelKit.ps1` yourself, start a new PowerShell window. A session keeps the kit's compiled parts until it closes, and the kit tells you if a different version's are already loaded. - One `Invoke-PkRun` at a time per PowerShell process: a call made while one is already running, nested or from another runspace, just runs inside it. Several dispatchers can run at once inside one run (one per runspace job, say); they share its abort state and can share a `SemaphoreSlim` to enforce a combined concurrency limit. - A worker stuck inside a long .NET call can't be interrupted. Force-stop stops waiting for it and returns. The worker is NOT killed: once that call returns it can carry on to the end of its script. Before any step that can't be undone (deleting a source file, say), have the worker check `Test-PkCancelRequested` and skip the step if it's true. From 13c75b335f29d7203c3a01770d1b0060c47c2316 Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Wed, 2 Dec 2026 11:43:07 -0500 Subject: [PATCH 2/2] README: the module-version example for 4.1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 241e49d..a123e49 100644 --- a/README.md +++ b/README.md @@ -180,7 +180,7 @@ Import-Module C:\Modules\ParallelKit Installed, or built into a `ParallelKit` folder somewhere on `$env:PSModulePath`, `Import-Module ParallelKit` finds it by name, and so does a call to any of its functions without importing it first. The rest of this README applies either way. -The module's version always has three parts: the kit's X.Y (what `Initialize-ParallelKit` reports) is the module's X.Y.0, and an X.Y.Z version stays as it is. So for 4.0, `Get-Module ParallelKit` shows 4.0.0, and that's the version `Import-Module -RequiredVersion` takes. +The module's version always has three parts: the kit's X.Y (what `Initialize-ParallelKit` reports) is the module's X.Y.0, and an X.Y.Z version stays as it is. So for 4.1, `Get-Module ParallelKit` shows 4.1.0, and that's the version `Import-Module -RequiredVersion` takes.
If the import is refused