Preserve stdout colors of subprocesses run by felt (flutter/engine#13209)

This commit is contained in:
Mouad Debbar
2019-10-18 10:41:44 -07:00
committed by GitHub
parent 1b32ee50fb
commit 237585efff
2 changed files with 2 additions and 12 deletions

View File

@@ -230,7 +230,6 @@ class TestCommand extends Command<bool> {
@required bool expectFailure,
}) async {
final List<String> testArgs = <String>[
'--no-color',
...<String>['-r', 'compact'],
'--concurrency=$concurrency',
if (isDebug) '--pause-after-load',

View File

@@ -43,8 +43,9 @@ Future<int> runProcess(
executable,
arguments,
workingDirectory: workingDirectory,
mode: io.ProcessStartMode.inheritStdio,
);
final int exitCode = await _forwardIOAndWait(process);
final int exitCode = await process.exitCode;
if (mustSucceed && exitCode != 0) {
throw ProcessException(
description: 'Sub-process failed.',
@@ -82,16 +83,6 @@ Future<String> evalProcess(
return result.stdout;
}
Future<int> _forwardIOAndWait(io.Process process) {
final StreamSubscription stdoutSub = process.stdout.listen(io.stdout.add);
final StreamSubscription stderrSub = process.stderr.listen(io.stderr.add);
return process.exitCode.then<int>((int exitCode) {
stdoutSub.cancel();
stderrSub.cancel();
return exitCode;
});
}
@immutable
class ProcessException implements Exception {
ProcessException({