| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of pipeline; | 5 part of pipeline; |
| 6 | 6 |
| 7 List log; | 7 List log; |
| 8 var replyPort; | 8 var replyPort; |
| 9 int _procId = 1; | 9 int _procId = 1; |
| 10 Map _procs = {}; | 10 Map _procs = {}; |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 stderr.add("Error starting process:"); | 94 stderr.add("Error starting process:"); |
| 95 stderr.add(" Command: $command"); | 95 stderr.add(" Command: $command"); |
| 96 stderr.add(" Error: ${e.toString()}"); | 96 stderr.add(" Error: ${e.toString()}"); |
| 97 return new Future.value(-1); | 97 return new Future.value(-1); |
| 98 }); | 98 }); |
| 99 } | 99 } |
| 100 | 100 |
| 101 Future _pipeStream(Stream stream, List<String> destination, | 101 Future _pipeStream(Stream stream, List<String> destination, |
| 102 Function outputMonitor) { | 102 Function outputMonitor) { |
| 103 return stream | 103 return stream |
| 104 .transform(new StringDecoder()) | 104 .transform(UTF8.decoder) |
| 105 .transform(new LineTransformer()) | 105 .transform(new LineTransformer()) |
| 106 .listen((String line) { | 106 .listen((String line) { |
| 107 if (config["immediate"] && line.startsWith('###')) { | 107 if (config["immediate"] && line.startsWith('###')) { |
| 108 print(line.substring(3)); | 108 print(line.substring(3)); |
| 109 } | 109 } |
| 110 if (outputMonitor != null) { | 110 if (outputMonitor != null) { |
| 111 outputMonitor(line); | 111 outputMonitor(line); |
| 112 } | 112 } |
| 113 destination.add(line); | 113 destination.add(line); |
| 114 }) | 114 }) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 203 |
| 204 void completePipeline(List stdout, List stderr, [exitCode = 0]) { | 204 void completePipeline(List stdout, List stderr, [exitCode = 0]) { |
| 205 replyPort.send([stdout, stderr, log, exitCode]); | 205 replyPort.send([stdout, stderr, log, exitCode]); |
| 206 } | 206 } |
| 207 | 207 |
| 208 /** Utility function to log diagnostic messages. */ | 208 /** Utility function to log diagnostic messages. */ |
| 209 void logMessage(msg) => log.add(msg); | 209 void logMessage(msg) => log.add(msg); |
| 210 | 210 |
| 211 /** Turn file paths into standard form with forward slashes. */ | 211 /** Turn file paths into standard form with forward slashes. */ |
| 212 String normalizePath(String p) => (new Path(p)).toString(); | 212 String normalizePath(String p) => (new Path(p)).toString(); |
| OLD | NEW |