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 String

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

final @NonNull Sequence<@NonNull String>

Allows incrementally consuming the stderr of the launched command as lines.

final @NonNull T
<T extends Object> stdErrStream(
    @ExtensionFunctionType @NonNull Function1<@NonNull InputStream, @NonNull T> block
)

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

final @NonNull Sequence<@NonNull String>

Allows incrementally consuming the stdout of the launched command as lines.

final @NonNull T
<T extends Object> stdOutStream(
    @ExtensionFunctionType @NonNull Function1<@NonNull InputStream, @NonNull T> block
)

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

Public constructors

CommandOutput

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

Public methods

getStdErr

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

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

getStdOut

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

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

stdErrLines

Added in 1.0.0-alpha01
public final @NonNull Sequence<@NonNull StringstdErrLines()

Allows incrementally consuming the stderr of the launched command as lines.

stdErrStream

Added in 1.0.0-alpha01
public final @NonNull T <T extends Object> stdErrStream(
    @ExtensionFunctionType @NonNull Function1<@NonNull InputStream, @NonNull T> block
)

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

stdOutLines

Added in 1.0.0-alpha01
public final @NonNull Sequence<@NonNull StringstdOutLines()

Allows incrementally consuming the stdout of the launched command as lines.

stdOutStream

Added in 1.0.0-alpha01
public final @NonNull T <T extends Object> stdOutStream(
    @ExtensionFunctionType @NonNull Function1<@NonNull InputStream, @NonNull T> block
)

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