feat(process): add Start-InfisicalProcess with event-based capture and friendly TimeSpan logging

- New cmdlet Start-InfisicalProcess: launches a child process with InfisicalSecret
  objects decrypted directly into ProcessStartInfo.Environment (optional -Prefix),
  additional -EnvironmentVariables, stdout/stderr capture, -AcceptableExitCodeList,
  -ParsingExpression regex parsing, -ExecutionTimeout / -ExecutionTimeoutInterval,
  -NoWait, -WindowStyle / -CreateNoWindow parameter sets, -Priority,
  -StandardInputObjectList, -SecureArgumentList, -LogOutput, -ContinueOnError, and
  ShouldProcess support. Secret plaintext is never written to user or machine scope.
- Stream capture uses event-based OutputDataReceived/ErrorDataReceived with
  BeginOutputReadLine/BeginErrorReadLine (no Task / ReadToEndAsync /
  GetAwaiter().GetResult()) to avoid PowerShell SynchronizationContext deadlocks.
- Restored the do { log; sleep } while (!HasExited) polling pattern using
  Thread.Sleep(pollInterval) so verbose "has been running for X" / "Checking again
  in Y" messages fire at the configured cadence even when no -ExecutionTimeout is
  supplied.
- TimeSpan values in verbose logs and on the result now use a friendly format
  ("7 seconds, and 364 milliseconds", "1 minute, and 30 seconds", "N/A" when zero)
  matching the legacy Start-ProcessWithOutput GetTimeSpanMessage scriptblock.
- Added DurationFriendly property to InfisicalProcessResult and a "The command
  execution took X" verbose line at completion.
- build.ps1 CmdletsToExport and Test-ModuleImports expected list contain 42 cmdlets.
- Added 9 xUnit tests covering FormatFriendly singular/plural, multi-unit joining,
  zero, sub-millisecond, and skip-zero-components behavior.
This commit is contained in:
GraceSolutions
2026-06-06 18:29:30 -04:00
parent d3c7b83da7
commit 207e7429e4
11 changed files with 780 additions and 10 deletions
+42 -7
View File
@@ -6,47 +6,82 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) loos
## Unreleased
- `Start-InfisicalProcess`: switched stdout/stderr capture to event-based `OutputDataReceived`/`ErrorDataReceived` with `BeginOutputReadLine`/`BeginErrorReadLine` (removed `Task`/`ReadToEndAsync`/`GetAwaiter().GetResult()` to eliminate PowerShell `SynchronizationContext` deadlock risk). Restored the original `do { log; sleep } while (!HasExited)` polling pattern using `Thread.Sleep(pollInterval)` so verbose "has been running for X" / "Checking again in Y" messages fire at the configured cadence even when no `-ExecutionTimeout` is supplied.
- `Start-InfisicalProcess`: TimeSpan values in verbose logs and on the result now use a friendly format ("`7 seconds, and 364 milliseconds`", "`1 minute, and 30 seconds`", "`N/A`" when zero) matching the legacy `Start-ProcessWithOutput` `GetTimeSpanMessage` scriptblock. Added `DurationFriendly` property to `InfisicalProcessResult` and a "The command execution took X" verbose line at completion.
## 2026.06.06.2227
- Build produced from commit d3c7b83da717.
## Unreleased (carried forward)
## 2026.06.06.2221
- Build produced from commit d3c7b83da717.
## Unreleased (carried forward)
## 2026.06.06.2207
- Build produced from commit d3c7b83da717.
## Unreleased (carried forward)
## 2026.06.06.2206
- Build produced from commit d3c7b83da717.
## Unreleased (carried forward)
## 2026.06.06.2155
- Build produced from commit d3c7b83da717.
## Unreleased (carried forward)
- Added `Start-InfisicalProcess` cmdlet: launches a child process with `InfisicalSecret` objects (pipeline or `-Secret`) decrypted directly into `ProcessStartInfo.Environment`, with optional `-Prefix`, additional `-EnvironmentVariables`, stdout/stderr capture, `-AcceptableExitCodeList` validation, `-ParsingExpression` regex parsing, `-ExecutionTimeout`/`-ExecutionTimeoutInterval` polling, `-NoWait`, `-WindowStyle`/`-CreateNoWindow` parameter sets, `-Priority`, `-StandardInputObjectList`, `-SecureArgumentList`, `-LogOutput`, `-ContinueOnError`, and `ShouldProcess` support. Secret plaintext is never written to user or machine scope. `build.ps1` `CmdletsToExport` and `Test-ModuleImports` expected list now contain 42 cmdlets.
## 2026.06.06.2138
- Build produced from commit 318db7048017.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.2040
- Build produced from commit 1270c9099cae.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.0240
- Build produced from commit b438abf18f18.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.0215
- Build produced from commit 82f99ea7d4a4.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.0205
- Build produced from commit 86968c18cb15.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.0117
- Build produced from commit cffda99591c9.
## Unreleased (carried forward)
## Unreleased (carried forward)
## 2026.06.05.0015
- Build produced from commit fb27ab8a8503.
## Unreleased (carried forward)
## Unreleased (carried forward)
- Fixed `ParameterNameConflictsWithAlias` registration error on `Get-InfisicalCertificateApplication`, `Get-InfisicalCertificateApplicationEnrollment`, and `New-InfisicalScepDynamicChallenge`. The cmdlets each declared an `[Alias]` entry that matched the parameter's own name, which PowerShell rejects at bind time and made the cmdlets unusable.