ShellRunnable
Undocumented
-
Undocumented
-
run(_:_:file:line:)Extension methodShortcut for shell command, returns output and errors as a String.
Warning
will crash if ‘executable’ could not be launched.Declaration
Swift
public func run (executable: String, _ args: Any ..., file: String = #file, line: Int = #line) -> StringParameters
executablepath to an executable file.
argsthe arguments, one string for each.
Return Value
standard output and standard error in one string, trimmed of whitespace and newline if it is single-line.
-
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) -> AsyncShellTaskParameters
executablePath to an executable file. If not then exit.
argsArguments to the executable.
Return Value
An AsyncShellTask with standard output, standard error and a ‘finish’ function.
-
runAndPrint(_:_:)Extension methodRun executable and print output and errors.
Throws
ShellError.ReturnedErrorCode (command: String, errorcode: Int32)if the exit code is anything but 0.ShellError.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.
-
run(bash:file:line:)Extension methodShortcut for bash shell command, returns output and errors as a String.
Declaration
Swift
public func run (bash bashcommand: String, file: String = #file, line: Int = #line) -> StringParameters
bashcommandthe bash shell command.
Return Value
standard output and standard error in one string, trimmed of whitespace and newline if it is single-line.
-
runAsync(bash:)Extension methodRun bash command and return before it is finished.
Declaration
Swift
public func runAsync (bash bashcommand: String) -> AsyncShellTaskParameters
bashcommandthe bash shell command.
Return Value
an AsyncShellTask struct with standard output, standard error and a ‘finish’ function.
-
runAndPrint(bash:)Extension methodRun bash command and print output and errors.
Throws
a ShellError.ReturnedErrorCode if the return code is anything but 0.Declaration
Swift
public func runAndPrint (bash bashcommand: String) throwsParameters
bashcommandthe bash shell command.
View on GitHub
ShellRunnable Protocol Reference