run method
Runs a given executable with the given args. If the flag showOutput is true, the stdout and sterr streams will be outputted to the console
Implementation
Future<int> run(
String executable,
List<String> args, {
Directory? workingDirectory,
bool showOutput = false,
}) async {
final process = await Process.start(
whichSync(executable) ?? executable,
args,
workingDirectory: workingDirectory?.absolute.path,
);
final nullPrinter = (_) {};
final errorPen = AnsiPen()..red();
final errorPrinter = (line) => print(errorPen(line));
_printOutput(
process.stdout,
printer: showOutput ? print : nullPrinter,
);
_printOutput(
process.stderr,
printer: showOutput ? errorPrinter : nullPrinter,
);
return await process.exitCode;
}