public class CommandResult
extends java.lang.Object
This record wraps the output and exit code from a terminal command execution, providing a clean interface for the common case of running a command and checking its result.
Example usage:
CommandResult result = context.execute("make", "build");
if (result.exitCode() == 0) {
context.sendMessage("Build succeeded!");
} else {
context.sendMessage("Build failed: " + result.output());
}
SyncPromptContext.execute(String...),
PromptContext.execute(String...)| 构造器和说明 |
|---|
CommandResult(java.lang.String output,
int exitCode)
Creates a CommandResult with the given output and exit code.
|