Structurefwcd.swift-utils 4.6.2Utils
Shell
A wrapper that simplifies the creation of subprocesses.
struct Shell
A wrapper that simplifies the creation of subprocesses.
struct Shell
import Utils
init()
func execute(process: Process) throws
func findPath(of executable: String) -> String
func newProcess(_ executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false, withPipedOutput: Bool = false, then terminationHandler: ((Process, Pipe?) -> Void)? = nil) -> (Pipe?, Process)
Creates a new subprocess without launching it.
@discardableResult func output(for executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false) -> Promise<Data, Error>
Runs the executable and asynchronously returns the standard output.
@discardableResult func outputSync(for executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false) throws -> Data
Runs the executable and returns the standard output synchronously after the process exits.
func run(_ executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false, withPipedOutput: Bool = false, then terminationHandler: ((Process, Pipe?) -> Void)? = nil) throws
Creates a new subprocess and launches it.
@discardableResult func utf8(for executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false) -> Promise<String?, Error>
Runs the executable and asynchronously returns the standard output.
@discardableResult func utf8Sync(for executable: String, in directory: URL? = nil, args: [String]? = nil, useBash: Bool = false) throws -> String?
Runs the executable and returns the standard output synchronously after the process exits.