myRunGit function

Future<ProcessResult> myRunGit(
  1. List<String> args, {
  2. bool throwOnError = true,
  3. String? processWorkingDir,
  4. Encoding? stdoutEncoding = systemEncoding,
  5. Encoding? stderrEncoding = systemEncoding,
})

Implementation

Future<ProcessResult> myRunGit(
  List<String> args, {
  bool throwOnError = true,
  String? processWorkingDir,
  Encoding? stdoutEncoding = systemEncoding,
  Encoding? stderrEncoding = systemEncoding,
}) async {
  final pr = await Process.run(
    'git',
    args,
    workingDirectory: processWorkingDir,
    runInShell: true,
    stdoutEncoding: stdoutEncoding,
    stderrEncoding: stderrEncoding,
  );

  if (throwOnError) {
    _throwIfProcessFailed(pr, 'git', args);
  }
  return pr;
}