Background
Currently, our Shell module uses Foundation's Process API to execute command line commands. The Swift team has released swift-subprocess, a new cross-platform package for spawning processes with a more modern, Swift-native API.
Benefits of swift-subprocess
- Async/await native - Built for Swift concurrency from the ground up
- More Swifty API - Cleaner syntax compared to the imperative
Process API
- Cross-platform - Designed to work across macOS, Linux, and Windows (Right now we use
Process essentially only to execute xcodebuild commands which are only available on macOS)
- Maintained by Swift team - Part of the official swiftlang organization
Current blockers
- Requires Swift 6.1 - The package uses
swift-tools-version: 6.1, while we currently target Swift 5.9
- Uses experimental features - Relies on
StrictConcurrency, NonescapableTypes, LifetimeDependence, and Span
- iOS not supported - Platform requirement is set to
.iOS("99.0") (effectively disabled), though this doesn't affect us since Shell only runs on macOS
References
Background
Currently, our
Shellmodule uses Foundation'sProcessAPI to execute command line commands. The Swift team has released swift-subprocess, a new cross-platform package for spawning processes with a more modern, Swift-native API.Benefits of swift-subprocess
ProcessAPIProcessessentially only to executexcodebuildcommands which are only available on macOS)Current blockers
swift-tools-version: 6.1, while we currently target Swift 5.9StrictConcurrency,NonescapableTypes,LifetimeDependence, andSpan.iOS("99.0")(effectively disabled), though this doesn't affect us since Shell only runs on macOSReferences