CommandRunning
public protocol CommandRunning
Can run commands.
-
run(bash:combineOutput:)Extension methodRuns a bash shell command.
Declaration
Swift
@discardableResult public func run(bash bashcommand: String, combineOutput: Bool = false) -> RunOutputParameters
bashcommandthe bash shell command.
combineOutputif true then stdout and stderror go to the same stream. Default is false.
-
runAsync(bash:file:line:)Extension methodRuns bash command and returns before it is finished.
Declaration
Swift
public func runAsync(bash bashcommand: String, file: String = #file, line: Int = #line) -> AsyncCommandParameters
bashcommandthe bash shell command.
-
runAsyncAndPrint(bash:file:line:)Extension methodRuns bash command and returns before it is finished. Any output is printed to standard output and standard error, respectively.
Declaration
Swift
public func runAsyncAndPrint(bash bashcommand: String, file: String = #file, line: Int = #line) -> PrintedAsyncCommandParameters
bashcommandthe bash shell command.
-
runAndPrint(bash:)Extension methodRuns bash command and prints output and errors.
Throws
a CommandError.returnedErrorCode if the return code is anything but 0.Declaration
Swift
public func runAndPrint(bash bashcommand: String) throwsParameters
bashcommandthe bash shell command.
-
run(_:_:combineOutput:)Extension methodRuns a command.
Declaration
Swift
@discardableResult public func run(_ executable: String, _ args: Any..., combineOutput: Bool = false) -> RunOutputParameters
executablepath to an executable, or the name of an executable in PATH.
argsthe arguments, one string for each.
combineOutputif true then stdout and stderror go to the same stream. Default is false.
-
runAsync(_:_:file:line:)Extension methodRuns executable and returns before it is finished.
Warning
Application will be terminated if ‘executable’ could not be launched.Declaration
Swift
public func runAsync(_ executable: String, _ args: Any..., file: String = #file, line: Int = #line) -> AsyncCommandParameters
executablePath to an executable file. If not then exit.
argsArguments to the executable.
-
runAsyncAndPrint(_:_:file:line:)Extension methodRuns executable and returns before it is finished. Any output is printed to standard output and standard error, respectively.
Warning
Application will be terminated if ‘executable’ could not be launched.Declaration
Swift
public func runAsyncAndPrint(_ executable: String, _ args: Any..., file: String = #file, line: Int = #line) -> PrintedAsyncCommandParameters
executablePath to an executable file. If not then exit.
argsArguments to the executable.
-
runAndPrint(_:_:)Extension methodRuns executable and prints output and errors.
Throws
CommandError.returnedErrorCode(command: String, errorcode: Int)if the exit code is anything but 0.CommandError.inAccessibleExecutable(path: String)if ‘executable’ turned out to be not so executable after all.Declaration
Swift
public func runAndPrint(_ executable: String, _ args: Any...) throwsParameters
executablepath to an executable file.
argsarguments to the executable.
View on GitHub
CommandRunning Protocol Reference