exec method

  1. @override
Future<Result<ShellExecResult, ExecutionError>> exec(
  1. String command, {
  2. ShellExecOptions? options,
})
override

Executes a shell command. Must never throw: all failures are encoded in the returned Result.

Implementation

@override
Future<Result<ShellExecResult, ExecutionError>> exec(
  String command, {
  ShellExecOptions? options,
}) {
  if (_secrets.isEmpty) return _delegate.exec(command, options: options);
  // Per-call env entries win over the injected secrets.
  final merged = ShellExecOptions(
    cwd: options?.cwd,
    env: {..._secrets, ...?options?.env},
    timeout: options?.timeout,
    cancelToken: options?.cancelToken,
    onStdout: options?.onStdout,
    onStderr: options?.onStderr,
  );
  return _delegate.exec(command, options: merged);
}