runCommand method

Future<ProcessResult> runCommand(
  1. Iterable<String> args, {
  2. bool throwOnError = true,
  3. bool echoOutput = false,
})

If echoOutput is true, the output of the git command will be echoed. Note: echoOutput true will also cause the returned ProcessResult to have null values for ProcessResult.stdout and ProcessResult.stderr.

Implementation

Future<ProcessResult> runCommand(
  Iterable<String> args, {
  bool throwOnError = true,
  bool echoOutput = false,
}) {
  final list = args.toList();

  for (final arg in list) {
    requireArgumentNotNullOrEmpty(arg, 'args');
    requireArgument(
      !arg.contains(_workTreeArg),
      'args',
      'Cannot contain $_workTreeArg',
    );
    requireArgument(
      !arg.contains(_gitDirArg),
      'args',
      'Cannot contain $_gitDirArg',
    );
  }

  if (_gitWorkTree != null) {
    list.insert(0, '$_workTreeArg$_gitWorkTree');
  }

  return runGit(
    list,
    throwOnError: throwOnError,
    processWorkingDir: _processWorkingDir,
    echoOutput: echoOutput,
  );
}