PrintedAsyncCommand

public class PrintedAsyncCommand

Output from the runAsyncAndPrint commands.

  • Is the command still running?

    Declaration

    Swift

    public var isRunning: Bool { get }
  • Terminates the command by sending the SIGTERM signal.

    Declaration

    Swift

    public func stop()
  • Interrupts the command by sending the SIGINT signal.

    Declaration

    Swift

    public func interrupt()
  • Temporarily suspends a command. Call resume() to resume a suspended command.

    Warning

    You may suspend a command multiple times, but it must be resumed an equal number of times before the command will truly be resumed.

    Declaration

    Swift

    @discardableResult
    public func suspend() -> Bool

    Return Value

    true iff the command was successfully suspended.

  • Resumes a command previously suspended with suspend().

    Warning

    If the command has been suspended multiple times then it will have to be resumed the same number of times before execution will truly be resumed.

    Declaration

    Swift

    @discardableResult
    public func resume() -> Bool

    Return Value

    true if the command was successfully resumed.

  • Waits for this command to finish.

    Warning

    Hangs if the unread output of either standard output or standard error is larger than 64KB (#52). To work around this problem, read all the output first, even if you’re not going to use it.

    Throws

    CommandError.returnedErrorCode(command: String, errorcode: Int) if the exit code is anything but 0.

    Declaration

    Swift

    @discardableResult
    public func finish() throws -> Self

    Return Value

    self

  • Waits for command to finish, then returns with exit code.

    Declaration

    Swift

    public func exitcode() -> Int
  • Waits for the command to finish, then returns why the command terminated.

    Declaration

    Swift

    public func terminationReason() -> Process.TerminationReason

    Return Value

    .exited if the command exited normally, otherwise .uncaughtSignal.

  • Takes a closure to be called when the command has finished.

    Declaration

    Swift

    @discardableResult
    public func onCompletion(_ handler: @escaping (PrintedAsyncCommand) -> Void) -> Self

    Parameters

    handler

    A closure taking this AsyncCommand as input, returning nothing.

    Return Value

    This PrintedAsyncCommand.