run method

Future<ProcessResult> run(
  1. String executable,
  2. List<String> arguments, {
  3. String? workingDirectory,
  4. Map<String, String>? environment,
  5. bool inheritStdio = false,
})

Run a command and return the result

Implementation

Future<ProcessResult> run(
  String executable,
  List<String> arguments, {
  String? workingDirectory,
  Map<String, String>? environment,
  bool inheritStdio = false,
}) async {
  if (showVerbose) {
    verbose('Running: $executable ${arguments.join(' ')}');
    if (workingDirectory != null) {
      verbose('  in: $workingDirectory');
    }
  }

  final io.ProcessResult result = await Process.run(
    executable,
    arguments,
    workingDirectory: workingDirectory,
    environment: environment,
    runInShell: Platform.isWindows,
  );

  return ProcessResult(
    exitCode: result.exitCode,
    stdout: result.stdout.toString(),
    stderr: result.stderr.toString(),
  );
}