runDartCommand method
Implementation
Future<int> runDartCommand(List<String> args,
{String? workingDirectory, bool inheritStdio = false}) async {
var dartExecutable = await this.dartExecutable;
workingDirectory ??= Directory.current.path;
var processMode =
inheritStdio ? ProcessStartMode.inheritStdio : ProcessStartMode.normal;
var process = await Process.start(dartExecutable, args,
workingDirectory: workingDirectory, mode: processMode);
if (processMode == ProcessStartMode.normal) {
var outputDecoder = systemEncoding.decoder;
process.stdout.transform(outputDecoder).forEach((o) => stdout.write(o));
process.stderr.transform(outputDecoder).forEach((o) => stderr.write(o));
}
var exitCode = await process.exitCode;
return exitCode;
}