AsyncCommand

public final class AsyncCommand

Output from the ‘runAsync’ methods.

  • Undocumented

    Declaration

    Swift

    public let stdout: ReadableStream
  • Undocumented

    Declaration

    Swift

    public let stderror: ReadableStream
  • Is the command still running?

    Declaration

    Swift

    public var isRunning: Bool
  • Terminates command.

    Declaration

    Swift

    public func stop()
  • Wait for this command to finish.

    Warning

    Will hang 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 -> AsyncCommand

    Return Value

    self

  • Wait for command to finish, then return with exit code.

    Declaration

    Swift

    public func exitcode() -> Int
  • Takes a closure to be called when the command has finished.

    Declaration

    Swift

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

    Parameters

    handler

    A closure taking this AsyncCommand as input, returning nothing.

    Return Value

    This AsyncCommand.