call method

Future<ProcessResult> call(
  1. List<String> arguments, {
  2. required String directory,
  3. bool check = true,
})

Runs git <arguments> in directory. Throws a DpkException when git fails, unless check is false.

Implementation

Future<ProcessResult> call(
  List<String> arguments, {
  required String directory,
  bool check = true,
}) async {
  final ProcessResult result;
  try {
    result = await processRunner.run('git', [
      ..._settings,
      ...arguments,
    ], workingDirectory: directory);
  } on ProcessException {
    throw DpkException(
      'git is not installed or not on PATH. Patching needs git.',
    );
  }
  if (check && result.exitCode != 0) {
    throw DpkException(
      'git ${arguments.join(' ')} failed in $directory:\n'
      '${(result.stderr as String).trim()}',
    );
  }
  return result;
}