tannerdsilva/swiftslash
Dependency-free, high-performance concurrent shell framework for Swift 6.0+
π Documentation
Full DocC documentation is available at swiftslash.com/documentation.
π Bring Your Own Data Channels
Don't want SwiftSlash's built-in stdio pipeline for a given process? Hand it a file descriptor you already own β SwiftNIO, sockets, PTYs, or anything else β and SwiftSlash binds it to the child and stays out of the data path entirely. Reaping and cancellation remain fully intact.
import Foundation
import SwiftSlash
let pipe = Pipe()
let child = ChildProcess(
try Command("/bin/cat"),
dataChannels: [
STDIN_FILENO: .read(.byo(fd: .init(rawValue: pipe.fileHandleForReading.fileDescriptor))),
STDOUT_FILENO: .write(.byo(fd: .init(rawValue: pipe.fileHandleForWriting.fileDescriptor))),
STDERR_FILENO: .write(.byo(fd: .init(rawValue: pipe.fileHandleForWriting.fileDescriptor)))
]
)
async let exit = child.run()
// ... drive `pipe` with SwiftNIO (or anything else) β SwiftSlash never touches it.See the BYO Data Channels article for the full ownership contract.
π€ Contributing
We welcome bug reports, feature requests, and pull requests.
π License
SwiftSlash is released under the MIT License. See LICENSE for details.
π¬ Contact
Stay up to date or ask questions on Twitter: @tannerdsilva
Package Metadata
Repository: tannerdsilva/swiftslash
Default branch: master
README: README.md