run method
Run a command in the root directory.
- This method is almost an encapsulation on Process.start.
- It will run with the root as current working directory.
- 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;
}