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 methodRun bash command and return before it is finished.
Declaration
Swift
public func runAsync(bash bashcommand: String, file: String = #file, line: Int = #line) -> AsyncCommandParameters
bashcommandthe bash shell command.
Return Value
an AsyncCommand struct with standard output, standard error and a ‘finish’ function.
-
runAndPrint(bash:)Extension methodRun bash command and print 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 methodRun executable and return before it is finished.
Warning
Will crash 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.
Return Value
An AsyncCommand with standard output, standard error and a ‘finish’ function.
-
runAndPrint(_:_:)Extension methodRun executable and print 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