runCmd function

Future<ProcessResult> runCmd(
  1. ProcessCmd cmd, {
  2. ShellOptions? options,
  3. bool? verbose,
  4. bool? commandVerbose,
  5. Stream<List<int>>? stdin,
  6. StreamSink<List<int>>? stdout,
  7. StreamSink<List<int>>? stderr,
})

Command runner

Execute a predefined ProcessCmd command Avoid and prefer Shell instead

if commandVerbose is true, it writes the command line executed preceeded by $ to stdout. It streams stdout/error if verbose is true. verbose implies commandVerbose

Implementation

///
/// Execute a predefined ProcessCmd command
/// Avoid and prefer Shell instead
///
/// if [commandVerbose] is true, it writes the command line executed preceeded by $ to stdout. It streams
/// stdout/error if [verbose] is true.
/// [verbose] implies [commandVerbose]
///
Future<ProcessResult> runCmd(
  ProcessCmd cmd, {
  ShellOptions? options,
  bool? verbose,
  bool? commandVerbose,
  Stream<List<int>>? stdin,
  StreamSink<List<int>>? stdout,
  StreamSink<List<int>>? stderr,
}) async {
  options ??= ShellOptions(
    throwOnError: false,
    verbose: verbose ?? false,
    commandVerbose: commandVerbose ?? verbose,
    stderrEncoding: cmd.stderrEncoding,
    stdoutEncoding: cmd.stdoutEncoding,
    workingDirectory: cmd.workingDirectory,
    stdin: stdin,
    stdout: stdout,
    stderr: stderr,
    environment: cmd.environment,
    includeParentEnvironment: cmd.includeParentEnvironment,
    runInShell: cmd.runInShell,
  );
  return await processCmdRun(cmd, options: options);
}