Update with more review feedback from jonahwilliams
* Remove the identity() function. * Make _flattenMap private. * Don't bother with ungrowable lists.
This commit is contained in:
parent
4f3b70671c
commit
9823b3dbd4
@ -136,8 +136,8 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
|||||||
print('$clock ELAPSED TIME: $bold${elapsedTime(start)}$reset for $commandDescription in $relativeWorkingDir: ');
|
print('$clock ELAPSED TIME: $bold${elapsedTime(start)}$reset for $commandDescription in $relativeWorkingDir: ');
|
||||||
|
|
||||||
if (output != null) {
|
if (output != null) {
|
||||||
output.stdout = flattenToString(await savedStdout);
|
output.stdout = _flattenToString(await savedStdout);
|
||||||
output.stderr = flattenToString(await savedStderr);
|
output.stderr = _flattenToString(await savedStderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the test is flaky we don't care about the actual exit.
|
// If the test is flaky we don't care about the actual exit.
|
||||||
@ -156,8 +156,8 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
|||||||
break;
|
break;
|
||||||
case OutputMode.capture:
|
case OutputMode.capture:
|
||||||
case OutputMode.discard:
|
case OutputMode.discard:
|
||||||
stdout.writeln(flattenToString(await savedStdout));
|
stdout.writeln(_flattenToString(await savedStdout));
|
||||||
stderr.writeln(flattenToString(await savedStderr));
|
stderr.writeln(_flattenToString(await savedStderr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
print(
|
print(
|
||||||
@ -171,11 +171,9 @@ Future<void> runCommand(String executable, List<String> arguments, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
T identity<T>(T x) => x;
|
|
||||||
|
|
||||||
/// Flattens a nested list of UTF-8 code units into a single string.
|
/// Flattens a nested list of UTF-8 code units into a single string.
|
||||||
String flattenToString(List<List<int>> chunks) =>
|
String _flattenToString(List<List<int>> chunks) =>
|
||||||
utf8.decode(chunks.expand<int>(identity).toList(growable: false));
|
utf8.decode(chunks.expand<int>((List<int> ints) => ints).toList());
|
||||||
|
|
||||||
/// Specifies what to do with command output from [runCommand].
|
/// Specifies what to do with command output from [runCommand].
|
||||||
enum OutputMode { print, capture, discard }
|
enum OutputMode { print, capture, discard }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user