Skip to content

v2.1

Choose a tag to compare

@HalRiveria HalRiveria released this 29 Oct 22:43
· 11 commits to main since this release
ba2ca8f

ParallelKit 2.1

After updating, start a new PowerShell window: a session that already loaded 2.0 refuses to load 2.1 and tells you so.

Changes you might notice

  • Programs start in your current location. Before, they ran in the PowerShell process's working folder, which cd and Set-Location never change. So after cd D:\work and .\script.ps1, programs started wherever the console had opened. A relative WorkingDirectory, a FilePath like .\tools\tool.exe, and paths on ~ or a New-PSDrive drive are now read the way PowerShell reads them. One case gets worse: a .bat or .cmd program run while your current location is a network share (\\server\share) falls back to C:\Windows, so give those a local WorkingDirectory. (#22)
  • Each runspace job starts clean. Every job starts in your current location, in a fresh scope. A folder change or a variable from an earlier job, $ErrorActionPreference included, no longer carries over to the next job on the same runspace. Inside a worker, $MyInvocation now describes a scriptblock call. (#23)
  • Abort messages say what actually happened. Ctrl+Break and Request-PkAbort are no longer announced as Ctrl+C, and Get-PkAbortTriggerLabel returns "Ctrl+Break" or "Request-PkAbort" for them. Force-stop messages give the real reason instead of always "did not finish within 60s". (#20)
  • CrashedCount also counts workers that threw while an abort waited for them, and the result of Invoke-PkRunspaceJobs has a new Crashed property. (#24)

Fixed

  • Pressing Ctrl+C again now skips the wait. It used to be held back until the 60-second drain ended, and then it stopped the script, losing a batch's result. Now the second press stops running jobs straight away and your script carries on; a third press stops the script. (#20)
  • Closing the window after Ctrl+C now runs -JobAbortCleanup before Windows ends the process. (#20)
  • A -ResultHandler written without .GetNewClosure() that did $results.Add(...) no longer loops forever. (#19)
  • Output you drop in -OnComplete ($result.Stdout = $null) is now freed as the batch goes, instead of being held until it returns. (#25)

New

  • -JobCrashedHandler { param($err, $job) } gets the job that crashed. One-parameter handlers work as before, and a handler that throws is now reported instead of swallowed. (#24)
  • The README now covers crashes: what counts as a worker crash, how to return an error object from a worker, and why not to call exit in one. (#24)
  • The test suite now sends real Ctrl+C, Ctrl+Break and window-close events, on every change, on 5.1 and 7. (#21)