From 4c455c8a6f50cfb54ebeb4dc05ec16a1b8caa414 Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:03:11 -0500 Subject: [PATCH 1/2] Start path: fall back on a setup failure, guard the readers, warn once, report Version and StartMode - A Win32 error while setting up a start inside the Job Object (pipes, the attribute list, the job attribute) failed the start, where 3.1 only lost that program's force-kill cleanup. It now falls back to Process.Start plus Assign; a failure of CreateProcess itself still reports that the program couldn't start. - The output readers were built after the program was resumed, outside the guard: if one failed, the program ran on untracked. They're built inside the guard now, and a failure ends the still-suspended program. - Falling back (no usable start lock, or a setup failure) was silent. It now warns once per process, saying a child started straight away can escape the cleanup. - Initialize-ParallelKit also returns Version and StartMode (CreatedInJob, AddedToJob or NoJob). The compiled types changed (TypesVersion 6): start a new PowerShell window after updating. Co-Authored-By: Claude Opus 5.5 --- ParallelKit.Harness.ps1 | 52 +++++++++++++- ParallelKit.ps1 | 153 +++++++++++++++++++++++++++++----------- README.md | 6 +- 3 files changed, 165 insertions(+), 46 deletions(-) diff --git a/ParallelKit.Harness.ps1 b/ParallelKit.Harness.ps1 index d6ed009..3c8d41f 100644 --- a/ParallelKit.Harness.ps1 +++ b/ParallelKit.Harness.ps1 @@ -1350,7 +1350,7 @@ Test-Assert ((Get-HarnessShape $shapeJobs) -eq 'ForceStoppedCount,CrashedCount,A $shapeFindings = Test-PkWorkerSafety -WorkerScript { param($Id) $null = [Func[int]]{ 1 } } $shapeFinding = $shapeFindings[0] Test-Assert ((Get-HarnessShape $shapeFinding) -eq 'Rule,Where,Line,Text') ("worker-safety findings are objects (" + (Get-HarnessShape $shapeFinding) + ")") -Test-Assert ((Get-HarnessShape (Initialize-ParallelKit)) -eq 'AbortHandler,ChildProcessJob,ThreadPool') "Initialize-ParallelKit returns an object" +Test-Assert ((Get-HarnessShape (Initialize-ParallelKit)) -eq 'AbortHandler,ChildProcessJob,ThreadPool,Version,StartMode') "Initialize-ParallelKit returns an object" $fields = @('Command', 'ExitCode', 'Stdout', 'Stderr', 'StreamTimedOut', 'StreamError', 'StartError', 'Aborted', 'TimedOut') $batch = Invoke-PkProcessBatch -MaxConcurrent 1 -Commands @( @@ -4304,6 +4304,56 @@ foreach ($s in $tkStarted) { $null = Complete-PkProcess $s -Dispose } Test-Assert ($tkKilled -and $tkPings.Count -eq 3 -and $tkLeft.Count -eq 0) ("with one PID per taskkill call, every program's children are still killed (" + $tkPings.Count + " children seen, " + $tkLeft.Count + " left running)") Write-Host "" +Write-Host "=== AW: when a program can't be created in the Job Object ===" -ForegroundColor Cyan +# A start whose setup fails (pipes, the attribute list, the job attribute) +# falls back to Process.Start and the Job Object just after, with a warning +# shown once, since that costs the cleanup of a child the program starts +# straight away. The harness's own switch to that path stays quiet. +Reset-Harness +$fbReset = [PkChildProcessJob].GetMethod('TestResetFallbackWarning') +if ($null -ne $fbReset) { $null = $fbReset.Invoke($null, @()) } +$fbOk = @(); $fbError = $null +[PkChildProcessJob]::TestFailSetup = $true +try { + foreach ($i in 1..2) { + $s = Start-PkProcess -FilePath $cmdExe -Arguments '/d /c ping -n 2 127.0.0.1 >nul& exit /b 3' + $fbInJob = [PkHarnessJobProbe]::InJob($s['Proc'].Id, $jobHandle) + $r = Complete-PkProcess $s -Dispose + $fbOk += ($r.ExitCode -eq 3 -and $fbInJob -ne $false) + } +} catch { $fbError = [string]$_ } finally { [PkChildProcessJob]::TestFailSetup = $false } +Test-Assert ($null -eq $fbError -and ($fbOk -join ',') -eq 'True,True') ("a start whose setup fails falls back to Process.Start, still in the Job Object (results: " + ($fbOk -join ',') + ", error: " + $fbError + ")") +$fbWarnings = @($script:messages | Where-Object { $_.Level -eq 'Warn' -and $_.Message -like '*Process.Start*' }) +Test-Assert ($fbWarnings.Count -eq 1 -and $fbWarnings[0].Message -like '*straight away*') ("and warns once, saying what it costs (" + $fbWarnings.Count + " warning(s))") +Reset-Harness +if ($null -ne $fbReset) { $null = $fbReset.Invoke($null, @()) } +[PkChildProcessJob]::TestUseProcessStart = $true +try { $null = Complete-PkProcess (Start-PkProcess -FilePath $cmdExe -Arguments '/d /c exit 0') -Dispose } finally { [PkChildProcessJob]::TestUseProcessStart = $false } +Test-Assert (@($script:messages | Where-Object { $_.Level -eq 'Warn' }).Count -eq 0) "the harness's switch to Process.Start doesn't warn" + +# A program whose output readers can't be built isn't left running untracked: +# the start fails and the program is ended. +[PkChildProcessJob]::TestFailReaders = $true +$rdError = $null +try { $null = Start-PkProcess -FilePath $pingExe -Arguments '-n 59 127.0.0.1' } catch { $rdError = [string]$_ } finally { [PkChildProcessJob]::TestFailReaders = $false } +$rdLeft = @(Get-CimInstance Win32_Process -Filter "Name='PING.EXE'" | Where-Object { [string]$_.CommandLine -like '* -n 59 *' }) +foreach ($l in $rdLeft) { Stop-Process -Id $l.ProcessId -Force -ErrorAction SilentlyContinue } +Test-Assert ($rdError -like '*could not start*' -and $rdLeft.Count -eq 0) ("a program whose output readers fail to build is ended and the start reported as failed (" + $rdLeft.Count + " left running, error: " + $rdError + ")") + +# Initialize-ParallelKit reports the kit's version and how it starts programs. +$ipHeader = [regex]::Match([System.IO.File]::ReadAllText((Join-Path $PSScriptRoot 'ParallelKit.ps1')), '(?m)^# Version (\d+\.\d+)').Groups[1].Value +$ipError = $null; $ip = $null; $ipAdded = $null +try { + $ip = Initialize-ParallelKit + [PkChildProcessJob]::TestUseProcessStart = $true + try { $ipAdded = (Initialize-ParallelKit).StartMode } finally { [PkChildProcessJob]::TestUseProcessStart = $false } +} catch { $ipError = [string]$_ } +$ipVersion = $null; $ipMode = $null +if ($null -ne $ip -and $null -ne $ip.PSObject.Properties['Version']) { $ipVersion = [string]$ip.Version; $ipMode = $ip.StartMode } +Test-Assert ($ipHeader -ne '' -and $ipVersion -eq $ipHeader) ("Initialize-ParallelKit's Version matches the header's Version line (" + $ipVersion + " vs " + $ipHeader + ")") +Test-Assert ($ipMode -eq 'CreatedInJob' -and $ipAdded -eq 'AddedToJob') ("and its StartMode says how programs start: CreatedInJob normally, AddedToJob without the start lock (" + $ipMode + ", " + $ipAdded + ", error: " + $ipError + ")") +Write-Host "" + Set-PkMessageHandler -Handler $null Reset-PkAbortState diff --git a/ParallelKit.ps1 b/ParallelKit.ps1 index 816c6e3..9e6e795 100644 --- a/ParallelKit.ps1 +++ b/ParallelKit.ps1 @@ -163,7 +163,7 @@ public static class PkState // Bump this, and the check after the type definitions, whenever any C# // in this file changes: a session keeps the types it compiled first. - public const int TypesVersion = 5; + public const int TypesVersion = 6; // Locked: Register-/Unregister-PkCancellationSource are callable from // worker runspaces, and List is not safe for concurrent writers. @@ -523,6 +523,29 @@ public static class PkChildProcessJob // Harness only: makes TryStart return null, to test the Process.Start path. public static bool TestUseProcessStart = false; + // Harness only: make a start's setup fail, or building its output readers. + public static bool TestFailSetup = false; + public static bool TestFailReaders = false; + + // How programs start here, for Initialize-ParallelKit: "CreatedInJob" + // (TryStart), "AddedToJob" (Process.Start, then the job: no usable start + // lock, or the harness switch), or "NoJob" (the job couldn't be set up, + // so nothing is cleaned up on a kill). A single start can still fall back + // from CreatedInJob when its setup fails; that warns. + public static string StartMode + { + get + { + if (_job == IntPtr.Zero) { return "NoJob"; } + if (TestUseProcessStart || GetStartLock() == null) { return "AddedToJob"; } + return "CreatedInJob"; + } + } + + // The fallback warning is shown once per process: true for the first caller. + private static int _fallbackWarned = 0; + public static bool ClaimFallbackWarning() { return Interlocked.Exchange(ref _fallbackWarned, 1) == 0; } + public static void TestResetFallbackWarning() { Interlocked.Exchange(ref _fallbackWarned, 0); } private static StringBuilder BuildCommandLine(string fileName, string arguments) { @@ -553,14 +576,17 @@ public static class PkChildProcessJob } // Starts the program in the job, or returns null when it can't do that - // safely (no job, no usable start lock): the caller then uses - // Process.Start and Assign. Throws Win32Exception when Windows refuses, - // as Process.Start does. encoding null: the console's output code page. - public static PkStartedProcess TryStart(string fileName, string arguments, string workingDirectory, Encoding encoding) + // safely: the caller then uses Process.Start and Assign. fallbackReason + // says why, for the caller's one-time warning; it stays null where no + // warning is due (no job, which has its own; the harness switch). Throws + // Win32Exception when Windows refuses to create the program, as + // Process.Start does. encoding null: the console's output code page. + public static PkStartedProcess TryStart(string fileName, string arguments, string workingDirectory, Encoding encoding, out string fallbackReason) { + fallbackReason = null; if (TestUseProcessStart || _job == IntPtr.Zero) { return null; } StartLock startLock = GetStartLock(); - if (startLock == null) { return null; } + if (startLock == null) { fallbackReason = ".NET's process-start lock isn't where the kit expects it on this .NET version"; return null; } if (encoding == null) { try { encoding = Encoding.GetEncoding((int)GetConsoleOutputCP()); } @@ -570,7 +596,8 @@ public static class PkChildProcessJob IntPtr outRead = IntPtr.Zero, outWrite = IntPtr.Zero, errRead = IntPtr.Zero, errWrite = IntPtr.Zero; IntPtr attrList = IntPtr.Zero, handleArr = IntPtr.Zero, jobArr = IntPtr.Zero; - bool attrReady = false, created = false; + bool attrReady = false, created = false, setupFailed = false; + IntPtr stdin = IntPtr.Zero; PROCESS_INFORMATION pi = new PROCESS_INFORMATION(); startLock.Enter(); @@ -578,35 +605,48 @@ public static class PkChildProcessJob { try { - CreateOutputPipe(out outRead, out outWrite); - CreateOutputPipe(out errRead, out errWrite); - - // stdin as Process.Start passes it: PowerShell's own. Listed - // only if inheritable, the only case the child could use it. - IntPtr stdin = GetStdHandle(STD_INPUT_HANDLE); - uint hflags; - bool stdinInherit = stdin != IntPtr.Zero && stdin != new IntPtr(-1) - && GetHandleInformation(stdin, out hflags) && (hflags & HANDLE_FLAG_INHERIT) != 0; - int handleCount = stdinInherit ? 3 : 2; - handleArr = Marshal.AllocHGlobal(IntPtr.Size * handleCount); - Marshal.WriteIntPtr(handleArr, 0, outWrite); - Marshal.WriteIntPtr(handleArr, IntPtr.Size, errWrite); - if (stdinInherit) { Marshal.WriteIntPtr(handleArr, 2 * IntPtr.Size, stdin); } - jobArr = Marshal.AllocHGlobal(IntPtr.Size); - Marshal.WriteIntPtr(jobArr, _job); - - IntPtr size = IntPtr.Zero; - InitializeProcThreadAttributeList(IntPtr.Zero, 2, 0, ref size); // fails by design: returns the size - attrList = Marshal.AllocHGlobal(size); - if (!InitializeProcThreadAttributeList(attrList, 2, 0, ref size)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } - attrReady = true; - if (!UpdateProcThreadAttribute(attrList, 0, PROC_THREAD_ATTRIBUTE_HANDLE_LIST, handleArr, - (IntPtr)(IntPtr.Size * handleCount), IntPtr.Zero, IntPtr.Zero) - || !UpdateProcThreadAttribute(attrList, 0, PROC_THREAD_ATTRIBUTE_JOB_LIST, jobArr, - (IntPtr)IntPtr.Size, IntPtr.Zero, IntPtr.Zero)) + // Setup: a failure here falls back to Process.Start and Assign + // (3.1's way) instead of failing the start. Only CreateProcess + // itself, below, reports that the program couldn't start. + try { - throw new Win32Exception(Marshal.GetLastWin32Error()); + CreateOutputPipe(out outRead, out outWrite); + CreateOutputPipe(out errRead, out errWrite); + + // stdin as Process.Start passes it: PowerShell's own. Listed + // only if inheritable, the only case the child could use it. + stdin = GetStdHandle(STD_INPUT_HANDLE); + uint hflags; + bool stdinInherit = stdin != IntPtr.Zero && stdin != new IntPtr(-1) + && GetHandleInformation(stdin, out hflags) && (hflags & HANDLE_FLAG_INHERIT) != 0; + int handleCount = stdinInherit ? 3 : 2; + handleArr = Marshal.AllocHGlobal(IntPtr.Size * handleCount); + Marshal.WriteIntPtr(handleArr, 0, outWrite); + Marshal.WriteIntPtr(handleArr, IntPtr.Size, errWrite); + if (stdinInherit) { Marshal.WriteIntPtr(handleArr, 2 * IntPtr.Size, stdin); } + jobArr = Marshal.AllocHGlobal(IntPtr.Size); + Marshal.WriteIntPtr(jobArr, _job); + + IntPtr size = IntPtr.Zero; + InitializeProcThreadAttributeList(IntPtr.Zero, 2, 0, ref size); // fails by design: returns the size + attrList = Marshal.AllocHGlobal(size); + if (!InitializeProcThreadAttributeList(attrList, 2, 0, ref size)) { throw new Win32Exception(Marshal.GetLastWin32Error()); } + attrReady = true; + if (!UpdateProcThreadAttribute(attrList, 0, PROC_THREAD_ATTRIBUTE_HANDLE_LIST, handleArr, + (IntPtr)(IntPtr.Size * handleCount), IntPtr.Zero, IntPtr.Zero) + || !UpdateProcThreadAttribute(attrList, 0, PROC_THREAD_ATTRIBUTE_JOB_LIST, jobArr, + (IntPtr)IntPtr.Size, IntPtr.Zero, IntPtr.Zero)) + { + throw new Win32Exception(Marshal.GetLastWin32Error()); + } + if (TestFailSetup) { throw new Win32Exception(5); } + } + catch (Win32Exception e) + { + setupFailed = true; + fallbackReason = "setting up a start inside the Job Object failed (" + e.Message + ")"; } + if (setupFailed) { return null; } // the finally blocks below clean up and release the lock STARTUPINFOEX si = new STARTUPINFOEX(); si.StartupInfo.cb = Marshal.SizeOf(typeof(STARTUPINFOEX)); @@ -645,17 +685,32 @@ public static class PkChildProcessJob } finally { startLock.Exit(); } + // Everything up to the resume is guarded, the output readers included: + // if any step fails, the program (still suspended) is ended and every + // handle released, so nothing is left running untracked. Process proc = null; + SafeFileHandle outSafe = null, errSafe = null; + StreamReader stdoutReader = null, stderrReader = null; try { proc = Process.GetProcessById(pi.dwProcessId); IntPtr opened = proc.Handle; // taken while it's suspended, so ExitCode stays readable however fast it exits + outSafe = new SafeFileHandle(outRead, true); + errSafe = new SafeFileHandle(errRead, true); + if (TestFailReaders) { throw new IOException("Test: building the output readers failed."); } + stdoutReader = new StreamReader(new FileStream(outSafe, FileAccess.Read, 4096, false), encoding, true, 4096); + stderrReader = new StreamReader(new FileStream(errSafe, FileAccess.Read, 4096, false), encoding, true, 4096); if (ResumeThread(pi.hThread) == 0xFFFFFFFF) { throw new Win32Exception(Marshal.GetLastWin32Error()); } } catch { TerminateProcess(pi.hProcess, 1); - CloseHandle(outRead); CloseHandle(errRead); + // A reader owns its handle; a SafeFileHandle not yet in a reader + // owns its own; before either, the raw handle is closed directly. + if (stdoutReader != null) { stdoutReader.Dispose(); } + if (outSafe != null) { outSafe.Dispose(); } else { CloseHandle(outRead); } + if (stderrReader != null) { stderrReader.Dispose(); } + if (errSafe != null) { errSafe.Dispose(); } else { CloseHandle(errRead); } CloseHandle(pi.hThread); CloseHandle(pi.hProcess); if (proc != null) { proc.Dispose(); } throw; @@ -665,8 +720,8 @@ public static class PkChildProcessJob PkStartedProcess r = new PkStartedProcess(); r.Process = proc; - r.Stdout = new StreamReader(new FileStream(new SafeFileHandle(outRead, true), FileAccess.Read, 4096, false), encoding, true, 4096); - r.Stderr = new StreamReader(new FileStream(new SafeFileHandle(errRead, true), FileAccess.Read, 4096, false), encoding, true, 4096); + r.Stdout = stdoutReader; + r.Stderr = stderrReader; return r; } } @@ -676,7 +731,7 @@ public static class PkChildProcessJob # A session that loaded an older copy keeps its compiled types. Say so, # rather than fail later with a missing-method error. Keep this number in # sync with [PkState]::TypesVersion. -if ((& { try { [PkState]::TypesVersion } catch { 0 } }) -ne 5) { +if ((& { try { [PkState]::TypesVersion } catch { 0 } }) -ne 6) { throw "ParallelKit: this PowerShell session already loaded an older version of the kit, and its compiled parts can't be swapped out. Close this window and start a new one." } @@ -855,13 +910,20 @@ function Initialize-ParallelKit { # 0 (the default) sizes it for up to about 48. # .OUTPUTS # An object with AbortHandler, ChildProcessJob and ThreadPool, each $true if that - # part worked. + # part worked; Version, the kit's version; and StartMode, how the kit starts + # programs here: CreatedInJob (inside the Job Object, so anything they start + # is in it too), AddedToJob (started, then added to it just after), or NoJob + # (no cleanup if PowerShell is killed). A program whose start can't be set up + # in the job falls back to AddedToJob, with a warning. [CmdletBinding()] param([int]$MaxConcurrentProcesses = 0) $handlerOk = Register-PkAbortHandler $jobOk = Initialize-PkChildProcessJob $poolOk = Initialize-PkThreadPool -MaxConcurrentProcesses $MaxConcurrentProcesses - return [pscustomobject][ordered]@{ AbortHandler = $handlerOk; ChildProcessJob = $jobOk; ThreadPool = $poolOk } + # The header's Version line: the version PR changes both, and the harness + # checks they match. + $version = [version]'3.2' + return [pscustomobject][ordered]@{ AbortHandler = $handlerOk; ChildProcessJob = $jobOk; ThreadPool = $poolOk; Version = $version; StartMode = [PkChildProcessJob]::StartMode } } function Register-PkCancellationSource { @@ -1346,8 +1408,15 @@ function Start-PkProcessCore { # In the job from its first instruction where possible; otherwise # Process.Start, and the job just after (a child it starts at once # can miss it then). - $started = [PkChildProcessJob]::TryStart($psi.FileName, $psi.Arguments, $psi.WorkingDirectory, $encoding) - if ($null -eq $started) { $proc = [System.Diagnostics.Process]::Start($psi) } + $fallbackReason = $null + $started = [PkChildProcessJob]::TryStart($psi.FileName, $psi.Arguments, $psi.WorkingDirectory, $encoding, [ref]$fallbackReason) + if ($null -eq $started) { + # Once per process: the cost is the same for every program after. + if ($null -ne $fallbackReason -and [PkChildProcessJob]::ClaimFallbackWarning()) { + Write-PkMessage ("[WARNING] Starting programs with Process.Start and adding them to the Job Object just after, because " + $fallbackReason + ". A child a program starts straight away (cmd /c tool.exe) can escape the cleanup if PowerShell is killed outright. Shown once.") -Level Warn + } + $proc = [System.Diagnostics.Process]::Start($psi) + } } catch { $tried = "" if ($psi.FileName -ne $FilePath) { $tried = " (" + $psi.FileName + ")" } diff --git a/README.md b/README.md index 516134e..5572826 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Dot-source it. It loads itself as an in-memory module named `ParallelKit`: nothi Its public functions are imported globally, so they stay available for the rest of that PowerShell session, and a `.GetNewClosure()` block can call them however your script was started. Its internal helpers stay inside the module. -`Initialize-ParallelKit` is optional. It registers the Ctrl+C handler, sets up child-process cleanup and sizes the thread pool up front; the engines set up what they need on first use either way. It returns an object with `AbortHandler`, `ChildProcessJob` and `ThreadPool`, each `$true` if that part worked (a failed abort handler or child-process cleanup also prints a warning). +`Initialize-ParallelKit` is optional. It registers the Ctrl+C handler, sets up child-process cleanup and sizes the thread pool up front; the engines set up what they need on first use either way. It returns an object with `AbortHandler`, `ChildProcessJob` and `ThreadPool`, each `$true` if that part worked (a failed abort handler or child-process cleanup also prints a warning), `Version`, the kit's version, and `StartMode`, how the kit starts programs here: `CreatedInJob` (inside the Job Object, the normal case), `AddedToJob` (started, then added to it just after) or `NoJob` (no cleanup if PowerShell is killed). It's the default for the session, not a promise for every program: one whose start can't be set up inside the Job Object falls back to `AddedToJob`, with a warning. Each public function has built-in help: `Get-Help Invoke-PkProcessBatch -Full` shows its parameters, their defaults, what it returns and an example. @@ -394,7 +394,7 @@ Inside `Invoke-PkRun`, no new ones start, and the running ones get up to 60 seco **And if the script is killed outright, from Task Manager say?** -The programs it started are killed with it, through a Windows Job Object. There's no waiting period and no cleanup callback in that case, so partial output files can be left behind. Each program is created inside the Job Object, so anything it starts is in it too, however soon. +The programs it started are killed with it, through a Windows Job Object. There's no waiting period and no cleanup callback in that case, so partial output files can be left behind. Each program is created inside the Job Object, so anything it starts is in it too, however soon. If the kit can't do that on some system (it relies on a private part of .NET), it starts the program and adds it to the Job Object just after, and warns once: a child the program starts in that moment can escape. `Initialize-ParallelKit`'s `StartMode` says which way it works. **Can I show progress?** @@ -422,7 +422,7 @@ It was built with Claude Code, as the top of this page says. The worker rules an ## Bugs and questions -Open an [issue](https://github.com/HalRiveria/PowerShell-ParallelKit/issues) with what you ran, what happened, and your Windows and PowerShell versions (`$PSVersionTable`). +Open an [issue](https://github.com/HalRiveria/PowerShell-ParallelKit/issues) with what you ran, what happened, your Windows and PowerShell versions (`$PSVersionTable`), and what `Initialize-ParallelKit` returns. ## License From fc075633d20400256469490b0e268240b609cafd Mon Sep 17 00:00:00 2001 From: Hal <22532613+HalRiveria@users.noreply.github.com> Date: Tue, 17 Nov 2026 18:09:41 -0500 Subject: [PATCH 2/2] Header: name Initialize-ParallelKit's copy of the version Co-Authored-By: Claude Opus 5.5 --- ParallelKit.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/ParallelKit.ps1 b/ParallelKit.ps1 index 9e6e795..b292c4a 100644 --- a/ParallelKit.ps1 +++ b/ParallelKit.ps1 @@ -3,6 +3,7 @@ # PowerShell 7. # # Version 3.2 - https://github.com/HalRiveria/PowerShell-ParallelKit +# (Initialize-ParallelKit reports the version too: change both together.) # Copyright (c) 2026 HalRiveria. MIT License: keep this notice with any copy; # the full text is in LICENSE in the repository. #