Skip to content

Commit 49a60b8

Browse files
[pigeon] Use dart:io output inheritance for tooling (flutter#5536)
Applies the same change as flutter/packages#5410 to the Pigeon tooling, avoiding the need to manually wire up output forwarding. Also adjusts a call site in the tooling that was forwarding all output normally but then also logging all output on failure to only log all output on failure.
1 parent 9a55d4c commit 49a60b8

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

packages/pigeon/tool/shared/generation.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,5 +246,6 @@ Future<int> formatAllFiles({required String repositoryRoot}) {
246246
'--packages=pigeon',
247247
],
248248
workingDirectory: repositoryRoot,
249+
streamOutput: false,
249250
logFailure: true);
250251
}

packages/pigeon/tool/shared/process_utils.dart

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,19 @@
33
// found in the LICENSE file.
44

55
import 'dart:async';
6-
import 'dart:io' show Process, stderr, stdout;
7-
8-
Future<Process> _streamOutput(Future<Process> processFuture) async {
9-
final Process process = await processFuture;
10-
await Future.wait(<Future<Object?>>[
11-
stdout.addStream(process.stdout),
12-
stderr.addStream(process.stderr),
13-
]);
14-
return process;
15-
}
6+
import 'dart:io' show Process, ProcessStartMode, stderr, stdout;
167

178
Future<int> runProcess(String command, List<String> arguments,
189
{String? workingDirectory,
1910
bool streamOutput = true,
2011
bool logFailure = false}) async {
21-
final Future<Process> future = Process.start(
12+
final Process process = await Process.start(
2213
command,
2314
arguments,
2415
workingDirectory: workingDirectory,
16+
mode:
17+
streamOutput ? ProcessStartMode.inheritStdio : ProcessStartMode.normal,
2518
);
26-
final Process process = await (streamOutput ? _streamOutput(future) : future);
2719
final int exitCode = await process.exitCode;
2820
if (exitCode != 0 && logFailure) {
2921
// ignore: avoid_print

0 commit comments

Comments
 (0)