run static method

Future<ProcessResult> run(
  1. String cmd,
  2. List<String> args, {
  3. bool throwOnError = true,
  4. String? workingDirectory,
  5. bool printErrors = true,
})

Implementation

static Future<ProcessResult> run(
  String cmd,
  List<String> args, {
  bool throwOnError = true,
  String? workingDirectory,
  bool printErrors = true,
}) async {
  final result = await Process.run(
    cmd,
    args,
    workingDirectory: workingDirectory,
    runInShell: true,
  );

  if (printErrors) {
    print(result.stderr);
    print(result.stdout);
  }

  if (throwOnError) {
    if (result.stderr != null) {
      _throwIfProcessFailed(result, cmd, args);
    }
  }
  return result;
}