Commit e3ffa768 authored by James Lin's avatar James Lin Committed by James D. Lin

Update with review feedback from dnfield and jonahwilliams

parent c02b805c
......@@ -113,14 +113,18 @@ Future<void> runCommand(String executable, List<String> arguments, {
.where((String line) => removeLine == null || !removeLine(line))
.map((String line) => '$line\n')
.transform(const Utf8Encoder());
if (outputMode == OutputMode.print) {
await Future.wait<void>(<Future<void>>[
stdout.addStream(stdoutSource),
stderr.addStream(process.stderr),
]);
} else {
savedStdout = stdoutSource.toList();
savedStderr = process.stderr.toList();
switch (outputMode) {
case OutputMode.print:
await Future.wait<void>(<Future<void>>[
stdout.addStream(stdoutSource),
stderr.addStream(process.stderr),
]);
break;
case OutputMode.capture:
case OutputMode.discard:
savedStdout = stdoutSource.toList();
savedStderr = process.stderr.toList();
break;
}
final int exitCode = await process.exitCode.timeout(timeout, onTimeout: () {
......@@ -145,9 +149,14 @@ Future<void> runCommand(String executable, List<String> arguments, {
// Print the output when we get unexpected results (unless output was
// printed already).
if (outputMode != OutputMode.print) {
stdout.writeln(flattenToString(await savedStdout));
stderr.writeln(flattenToString(await savedStderr));
switch (outputMode) {
case OutputMode.print:
break;
case OutputMode.capture:
case OutputMode.discard:
stdout.writeln(flattenToString(await savedStdout));
stderr.writeln(flattenToString(await savedStderr));
break;
}
print(
'$redLine\n'
......
......@@ -817,7 +817,7 @@ Future<void> _runFlutterTest(String workingDirectory, {
List<String> tests = const <String>[],
}) async {
// Support printing output or capturing it for matching, but not both.
assert(_implies(printOutput, outputChecker == null));
assert(!printOutput || outputChecker == null);
final List<String> args = <String>[
'test',
......@@ -1009,8 +1009,3 @@ Future<void> _androidGradleTests(String subShard) async {
await _runDevicelabTest('module_host_with_custom_build_test', env: env);
}
}
/// Returns true if `p` logically implies `q`, false otherwise.
///
/// If `p` is true, `q` must be true.
bool _implies(bool p, bool q) => !p || q;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment