public final class Shell.CommandOutput


The output of a shell command executed via Shell.command. This class offers access to the stdOut and stdErr of the launched command, with utility methods to wait for the full output or parse the stream incrementally.

Summary

Public constructors

CommandOutput(@NonNull String command, @NonNull ShellProcess shellProcess)

Public methods

final @NonNull String

Awaits the process termination and returns the full stderr of the launched command.

final @NonNull InputStream

Allows incrementally consuming the stderr of a single command as an InputStream.

final @NonNull String

Awaits the process termination and returns the full stdout of the launched command.

final @NonNull InputStream

Allows incrementally consuming the stdout of a single command as an InputStream.

final boolean

Returns whether the launched shell command is still running.

Public constructors

CommandOutput

Added in 1.0.0-alpha02
public CommandOutput(@NonNull String command, @NonNull ShellProcess shellProcess)

Public methods

getStdErr

Added in 1.0.0-alpha02
public final @NonNull String getStdErr()

Awaits the process termination and returns the full stderr of the launched command.

getStdErrStream

Added in 1.0.0-alpha02
public final @NonNull InputStream getStdErrStream()

Allows incrementally consuming the stderr of a single command as an InputStream.

getStdOut

Added in 1.0.0-alpha02
public final @NonNull String getStdOut()

Awaits the process termination and returns the full stdout of the launched command.

getStdOutStream

Added in 1.0.0-alpha02
public final @NonNull InputStream getStdOutStream()

Allows incrementally consuming the stdout of a single command as an InputStream.

isRunning

Added in 1.0.0-alpha02
public final boolean isRunning()

Returns whether the launched shell command is still running.