Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 346adc0

Browse files
author
Emmanuel Garcia
committed
Fix flush issue
1 parent 01fa07c commit 346adc0

File tree

2 files changed

+6
-14
lines changed

2 files changed

+6
-14
lines changed

testing/scenario_app/bin/android_integration_tests.dart

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ void main(List<String> args) async {
9191
});
9292

9393
late Process logcatProcess;
94+
late Future<int> logcatProcessExitCode;
95+
9496
final IOSink logcat = File(logcatPath).openWrite();
9597
try {
9698
await step('Creating screenshot directory...', () async {
@@ -103,7 +105,7 @@ void main(List<String> args) async {
103105
panic(<String>['could not clear logs']);
104106
}
105107
logcatProcess = await pm.start(<String>[adb.path, 'logcat', '-T', '1']);
106-
unawaited(pipeProcessStreams(logcatProcess, out: logcat));
108+
logcatProcessExitCode = pipeProcessStreams(logcatProcess, out: logcat);
107109
});
108110

109111
await step('Configuring emulator...', () async {
@@ -209,6 +211,7 @@ void main(List<String> args) async {
209211
await step('Killing logcat process...', () async {
210212
final bool delivered = logcatProcess.kill(ProcessSignal.sigkill);
211213
assert(delivered);
214+
await logcatProcessExitCode;
212215
});
213216

214217
await step('Wait for Skia gold comparisons...', () async {

testing/scenario_app/bin/utils/process_manager_extension.dart

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,25 @@ import 'package:process/process.dart';
1010

1111
/// Pipes the [process] streams and writes them to [out] sink.
1212
/// If [out] is null, then the current [Process.stdout] is used as the sink.
13-
/// If [includePrefix] is true, then the prefix `[stdout]` or `[stderr]` is
14-
/// added before writting to the [out] sink.
1513
Future<int> pipeProcessStreams(
1614
Process process, {
1715
StringSink? out,
18-
bool includePrefix = true,
1916
}) async {
2017
out ??= stdout;
2118
final Completer<void> stdoutCompleter = Completer<void>();
2219
final StreamSubscription<String> stdoutSub = process.stdout
2320
.transform(utf8.decoder)
2421
.transform<String>(const LineSplitter())
2522
.listen((String line) {
26-
if (includePrefix) {
27-
out!.writeln('[stdout] $line');
28-
} else {
29-
out!.writeln(line);
30-
}
23+
out!.writeln('[stdout] $line');
3124
}, onDone: stdoutCompleter.complete);
3225

3326
final Completer<void> stderrCompleter = Completer<void>();
3427
final StreamSubscription<String> stderrSub = process.stderr
3528
.transform(utf8.decoder)
3629
.transform<String>(const LineSplitter())
3730
.listen((String line) {
38-
if (includePrefix) {
39-
out!.writeln('[stderr] $line');
40-
} else {
41-
out!.writeln(line);
42-
}
31+
out!.writeln('[stderr] $line');
4332
}, onDone: stderrCompleter.complete);
4433

4534
final int exitCode = await process.exitCode;

0 commit comments

Comments
 (0)