runInteractive method
Future<int>
runInteractive(
- String executable,
- List<
String> arguments, { - String? workingDirectory,
- Map<
String, String> ? environment,
override
Runs a process with its output going to the user, and returns its exit code. When the console is the real stdio, the process inherits stdin, stdout, and stderr.
Implementation
@override
Future<int> runInteractive(
String executable,
List<String> arguments, {
String? workingDirectory,
Map<String, String>? environment,
}) async {
if (console.isStdio) {
final process = await _guardStart(
() => Process.start(
executable,
arguments,
workingDirectory: workingDirectory,
environment: environment,
mode: ProcessStartMode.inheritStdio,
),
);
return _track(process, process.exitCode);
}
final process = await start(
executable,
arguments,
workingDirectory: workingDirectory,
environment: environment,
);
unawaited(process.stdin.close());
await Future.wait([
process.stdout.transform(utf8.decoder).forEach(console.out.write),
process.stderr.transform(utf8.decoder).forEach(console.err.write),
]);
return normalizeExitCode(await process.exitCode);
}