execute function

Future<void> execute(
  1. String command,
  2. List<String> arguments, {
  3. String? workingDirectory,
  4. bool quiet = false,
})

Implementation

Future<void> execute(
  String command,
  List<String> arguments, {
  String? workingDirectory,
  bool quiet = false,
}) async {
  final process = await io.Process.start(
    command,
    arguments,
    workingDirectory: workingDirectory,
    mode: quiet ? io.ProcessStartMode.normal : io.ProcessStartMode.inheritStdio,
    runInShell: true,
  );
  if (quiet) {
    unawaited(process.stderr.pipe(io.stderr));
  }
  final exitCode = await process.exitCode;
  if (exitCode != 0) {
    throw NonZeroExitCode(exitCode);
  }
}