execute method
Runs command to completion on nodeId, capturing its output.
stdin, when given, is fed to the command's standard input, followed by
end-of-input (see executeStreaming).
Implementation
Future<ExecResult> execute({
required String nodeId,
required String command,
List<String> args = const [],
Map<String, String> env = const {},
String? cwd,
ShellFamily? shellFamily,
List<int>? stdin,
}) async {
final out = BytesBuilder(copy: false);
final err = BytesBuilder(copy: false);
final code = await executeStreaming(
nodeId: nodeId,
command: command,
args: args,
env: env,
cwd: cwd,
shellFamily: shellFamily,
stdin: stdin,
onStdout: out.add,
onStderr: err.add,
);
return ExecResult(
exitCode: code,
stdout: out.takeBytes(),
stderr: err.takeBytes(),
);
}