run method

Future<int> run(
  1. String executable,
  2. List<String> arguments, {
  3. Map<String, String>? environment,
  4. bool includeParentEnvironment = true,
  5. bool runInShell = true,
  6. ProcessStartMode mode = ProcessStartMode.inheritStdio,
})

Run a command in the root directory.

  1. This method is almost an encapsulation on Process.start.
  2. It will run with the root as current working directory.
  3. It will inherit the stdio by default, but when it's unnecessary to output, you can specify the mode parameter to ProcessStartMode.detached.

Implementation

Future<int> run(
  String executable,
  List<String> arguments, {
  Map<String, String>? environment,
  bool includeParentEnvironment = true,
  bool runInShell = true,
  ProcessStartMode mode = ProcessStartMode.inheritStdio,
}) async {
  final process = await Process.start(
    executable,
    arguments,
    workingDirectory: root.path,
    environment: environment,
    includeParentEnvironment: includeParentEnvironment,
    runInShell: runInShell,
    mode: mode,
  );
  return process.exitCode;
}