Skip to content

Subprocess 1.0 Beta 1

Pre-release
Pre-release

Choose a tag to compare

@iCharlesHu iCharlesHu released this 02 Jul 18:08
40243d0

This is the first beta release for Subprocess 1.0. This release contains the API surface we intend to ship with Subprocess 1.0, while the final API review is underway.

API Changes

  • Signal.init(rawValue:) is now public, allowing arbitrary signals to be constructed. by @iCharlesHu in #291
  • run() body closures can now return non-Copyable values. by @iCharlesHu in #305
  • Restored standardOutput and standardError as @available(*, deprecated, renamed:) aliases for currentStandardOutput / currentStandardError. by @marcprux in #288
  • SubprocessError.WindowsError is now an enum. It no longer conforms to RawRepresentable (no rawValue: DWORD); instead it has cases .ntStatus, .win32, .hresult, and .cRuntime with matching initializers, so it can faithfully represent each Windows error subsystem. by @iCharlesHu in #299
  • ExecutionResult.closureOutput renamed to closureResult. As part of allowing run() body closures to return non-Copyable values, ExecutionResult is now conditionally Copyable and gains a consuming takeClosureResult(). by @iCharlesHu in #305
  • Windows UserCredentials is now internal. PlatformOptions.UserCredentials and PlatformOptions.userCredentials have been removed from the public API while the credentials-spawning design is deferred to post-1.0. by @jakepetroules in #285
  • Removed the duplicate unlabeled Configuration.init(_:arguments:…). Use the executable:-labeled initializer instead. by @iCharlesHu in #291

Behavior Changes

  • Teardown now runs when the run() body closure throws. Previously the child was left running until it exited on its own (which could hang indefinitely); the configured teardown sequence now terminates it. by @iCharlesHu in #292
  • Environment variables are validated before spawning. Malformed keys/values (NUL bytes, = or digit-leading keys, oversized Windows entries) now throw a descriptive SubprocessError.spawnFailed instead of spawning a child with a corrupt environment. by @iCharlesHu in #332
  • StandardInputWriter rejects writes after finish() with a clear SubprocessError rather than a cryptic "Bad file descriptor," and finish() is now idempotent. by @iCharlesHu in #311

Bug Fixes

Reliability & Correctness

  • Avoid a double-reap of the child after a read() is interrupted by EINTR, which could otherwise reap an unrelated child on a recycled PID. by @broken-circle in #282
  • Cancel a stalled standard-input writer when the child exits, fixing an indefinite hang when stdin is fed from a source that stalls. by @iCharlesHu in #306
  • Retry transient EAGAIN when spawning (bounded, jittered backoff), fixing spurious spawnFailed errors under high-concurrency / process-limit pressure. by @broken-circle in #312
  • Prevent process-descriptor and zombie leaks when a spawn fails at execve(). by @broken-circle in #319
  • Prevent a gid_t leak when spawning with processGroupID. by @broken-circle in #318
  • Fix a potential crash in fillNullTerminatedWideStringBuffer() under release optimization. by @broken-circle in #304

Windows

  • Security: Escape .bat / .cmd arguments against cmd.exe command injection (the "BatBadBut" class, CVE-2024-24576 / CVE-2024-43402). by @iCharlesHu in #298
  • Drain output still buffered in the pipe after a child exits and I/O is cancelled, and fix an overlapped-I/O bug where the kernel could write into a released buffer. by @broken-circle in #296
  • Recover the final read buffer when output capture is cancelled by child termination, fixing silent truncation of up to ~16 KB of captured output. by @broken-circle in #325
  • Fix a use-after-free on the standard-input write path when a child terminates mid-write. by @broken-circle in #336
  • Sort the environment block passed to CreateProcessW, as Windows requires, preventing a truncated/incorrect child environment. by @iCharlesHu in #307
  • Fix Environment.Key Comparable / Equatable conformance (case-insensitive equality had inconsistent ordering). by @broken-circle in #317, and fold keys to uppercase ordinally to match Windows sort order in
    #320
  • Stop leaking internal implementation details in PlatformOptions description output. by @broken-circle in #284

Platform Support

  • Monitor process termination with kqueue instead of DispatchSource, fixing FreeBSD pdfork children that never raise SIGCHLD and removing the Dispatch dependency entirely. by @iCharlesHu in #290
  • Fix OpenBSD platform support. by @jakepetroules in #293
  • Annotate pthread_t out-parameter nullability, and relocate its Sendable conformance off OpaquePointer, on musl. by @broken-circle in #333, #334

Documentation

  • Add a DocC catalog with task-based topics. by @broken-circle in #329
  • Expand and standardize Input and Output protocol documentation. by @broken-circle in #337
  • Spelling, wording, and grammar updates. by @heckj in #328
  • Fix README to use strings() and document separator behavior. by @nenadvulic in #310
  • Restructure the platform support table by testing category. by @jakepetroules in #294
  • Add SubprocessError symbol links to error-throwing docs, and fix broken symbol links. by @broken-circle in #323, #322

Infrastructure, Testing & Internal

Detailed Change List

New Contributors

Full Changelog: 0.5...1.0.0-beta.1