| Index: lib/src/executable.dart
|
| diff --git a/lib/src/executable.dart b/lib/src/executable.dart
|
| index 863f306f672e01c03349298ddf37efffcd3faa6c..788a8329f4d0b4a1cfcca05b76904bb4254dc476 100644
|
| --- a/lib/src/executable.dart
|
| +++ b/lib/src/executable.dart
|
| @@ -12,6 +12,7 @@ import 'package:path/path.dart' as p;
|
| import 'package:stack_trace/stack_trace.dart';
|
|
|
| import 'barback/asset_environment.dart';
|
| +import 'cr_lf_remover.dart';
|
| import 'entrypoint.dart';
|
| import 'exit_codes.dart' as exit_codes;
|
| import 'io.dart';
|
| @@ -127,8 +128,8 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
|
|
|
| // Note: we're not using process.std___.pipe(std___) here because
|
| // that prevents pub from also writing to the output streams.
|
| - process.stderr.listen(stderr.add);
|
| - process.stdout.listen(stdout.add);
|
| + _forwardOutput(process.stderr, stderr);
|
| + _forwardOutput(process.stdout, stdout);
|
| stdin.listen(process.stdin.add);
|
|
|
| return process.exitCode;
|
| @@ -231,8 +232,8 @@ Future<int> runSnapshot(String path, Iterable<String> args, {recompile(),
|
|
|
| // Note: we're not using process.std___.pipe(std___) here because
|
| // that prevents pub from also writing to the output streams.
|
| - process.stderr.listen(stderr.add);
|
| - process.stdout.listen(stdout.add);
|
| + _forwardOutput(process.stderr, stderr);
|
| + _forwardOutput(process.stdout, stdout);
|
| input.listen(process.stdin.add);
|
|
|
| return process.exitCode;
|
| @@ -261,6 +262,19 @@ void _forwardSignals(Process process) {
|
| }
|
| }
|
|
|
| +/// Forwards output from a Process's output stream to the corresponding stream
|
| +/// for pub.
|
| +///
|
| +/// On Windows, this replaces any CR LF sequences in the process's output with
|
| +/// just LF to work around sdk#19334.
|
| +void _forwardOutput(Stream<List<int>> stream, Sink<List<int>> sink) {
|
| + if (Platform.isWindows) {
|
| + log.fine("filtering out CR LF");
|
| + stream = const CRLFRemover().bind(stream);
|
| + }
|
| + stream.listen(sink.add);
|
| +}
|
| +
|
| /// Runs the executable snapshot at [snapshotPath].
|
| Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath,
|
| List<String> args) {
|
|
|