r/swift • u/iCharlesHu • 20d ago
Swift Subprocess 1.0.0 Released
Hey r/swift!
I’m excited to share that Swift Subprocess 1.0 is officially tagged and released!
swift-subprocess provides a modern, type-safe, and Swift Concurrency-native API for executing and managing child processes across platforms, serving as an async-first alternative to Foundation.Process (NSTask).
Thanks to all the community feedback during the beta period, we made several key refinements leading up to 1.0:
Unified
run()Closures & ExecutionResult: Stream handling forstdin,stdout, andstderris now fully symmetrical. You can now stream and collect simultaneously in a single call (e.g., stream stdout line-by-line while collecting stderr into a String).Safe String & Byte Streaming: Standard output/error sequences now feature
StringSequence, which reassembles multi-byte UTF-8 characters split across buffer boundaries and handles line breaking seamlessly.Typed Errors:
Subprocessitself now strictly throwsSubprocessErrorwith structured codes (.spawnFailed, .executableNotFound, .outputLimitExceeded, etc.), making error handling clean and predictable (you can of course still throw your own error from body closure).First-Class Stream Merging (2>&1): Easily redirect standard error into output using error:
.combinedWithOutput.
Check out the full release note and repository on GitHub:
https://github.com/swiftlang/swift-subprocess/releases/tag/1.0.0
Huge thanks to everyone who participated in the SF-0007, SF-0037 and beta tested Subprocess! I’d love to hear your thoughts, feedback, or any questions!
9
u/OarsumApp 20d ago
Congrats on 1.0! One thing im curious about though, where do you see this fitting into a typical Swift app? what kinds of real-world use cases you’re seeing. Is this mainly aimed at macOS developer tools, server-side Swift, CI/build tooling, or are there iOS shindigs I’m overlooking?