From 9e3e2c8f4fad11547107dd9b3ab4720edfbe729e Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Wed, 2 Dec 2026 20:08:14 -0500 Subject: [PATCH 1/2] README: the ConvertTo-PkArgumentString row names cmd.exe among the programs a list is quoted for --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ba7ac7f..156fa59 100644 --- a/README.md +++ b/README.md @@ -619,7 +619,7 @@ For one program at a time, outside the engines. All of these are safe in worker | Function | Use | |---|---| | `Invoke-PkProcessWithTimeout -FilePath -Arguments -TimeoutMs` | Run one program and wait, with a hard time limit (default 60s). Returns the [process result](#process-results) fields marked "all". If it overruns, or the run is aborted, the program is killed and this **throws**; called while an abort or cancel is already in force, it throws without starting the program. Add `-IgnoreAbort` for a cleanup step that must run anyway. | -| `ConvertTo-PkArgumentString @(args)` | Join a list of arguments into one correctly quoted command line. `-Arguments` / `Arguments` also take the list directly, and then also quote it for `cmd.exe` when the program is a `.bat` or `.cmd`. | +| `ConvertTo-PkArgumentString @(args)` | Join a list of arguments into one correctly quoted command line. `-Arguments` / `Arguments` also take the list directly, and then also quote it for `cmd.exe` when the program is `cmd.exe`, a `.bat` or a `.cmd`. | | `Start-PkProcess -FilePath -Arguments` | Start one hidden, with output captured in the background. Returns `@{ Proc; StdoutTask; StderrTask; Stopwatch }`; throws if it can't start. | | `Wait-PkProcess -Process -TimeoutMs` | Wait for exit with a timeout that can't overrun. Returns `$true` if it exited. | | `Complete-PkProcess -Job` | Collect exit code and output from a finished one (`-Job` is what `Start-PkProcess` returned). Same result as `Invoke-PkProcessWithTimeout`. | From c82dfd3693efb9b14095511bf1e8287fc7679cac Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Wed, 2 Dec 2026 20:36:52 -0500 Subject: [PATCH 2/2] Harness: wait for a killed tree to go before counting what's left The test that kills a live tree listed beside a disposed process counted leftover pings right after Stop-PkProcessTree returned. Ending a Job Object returns before Windows has finished tearing its processes down, so on a CI runner the ping was still listed once. It now waits up to 5 seconds for it to go, as the other kill tests do. --- ParallelKit.Harness.ps1 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ParallelKit.Harness.ps1 b/ParallelKit.Harness.ps1 index 2f00ceb..6e12203 100644 --- a/ParallelKit.Harness.ps1 +++ b/ParallelKit.Harness.ps1 @@ -3464,7 +3464,10 @@ while ((Get-LimitPingCount 53) -lt 1 -and $dispWait.Elapsed.TotalSeconds -lt 5) $dispThrew = $null $dispKilled = $false try { $dispKilled = Stop-PkProcessTree -Process @($dispGone.Proc, $dispLive.Proc) } catch { $dispThrew = [string]$_ } -$dispLeft = Get-LimitPingCount 53 +# Ending a Job Object returns before Windows has torn its processes down: +# give the ping a moment to go. +$dispWait = [System.Diagnostics.Stopwatch]::StartNew() +do { $dispLeft = Get-LimitPingCount 53; if ($dispLeft -eq 0) { break }; Start-Sleep -Milliseconds 100 } while ($dispWait.Elapsed.TotalSeconds -lt 5) Stop-StrayPings 53 Test-Assert ($null -eq $dispThrew -and $dispKilled -and $dispLeft -eq 0 -and $dispLive.Proc.HasExited) ("Stop-PkProcessTree kills a live tree listed beside a disposed process (" + $dispLeft + " left, returned " + $dispKilled + ", threw: " + $dispThrew + ")") try { if (-not $dispLive.Proc.HasExited) { $dispLive.Proc.Kill() } } catch { } # cleanup after a failure; already-exited is fine