Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: utils/pub/io.dart

Issue 14259002: Fix dartc tests and pub after IOSink change. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « samples/build_dart_simple/build.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /// Helper functionality to make working with IO easier. 5 /// Helper functionality to make working with IO easier.
6 library io; 6 library io;
7 7
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:isolate'; 10 import 'dart:isolate';
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 277 }
278 278
279 return path.normalize(path.join(utilDir, 'pub', target)); 279 return path.normalize(path.join(utilDir, 'pub', target));
280 } 280 }
281 281
282 // TODO(nweiz): add a ByteSink wrapper to make writing strings to stdout/stderr 282 // TODO(nweiz): add a ByteSink wrapper to make writing strings to stdout/stderr
283 // nicer. 283 // nicer.
284 284
285 /// A sink that writes to standard output. Errors piped to this stream will be 285 /// A sink that writes to standard output. Errors piped to this stream will be
286 /// surfaced to the top-level error handler. 286 /// surfaced to the top-level error handler.
287 final EventSink<List<int>> stdoutSink = _wrapStdio(stdout, "stdout"); 287 final EventSink<List<int>> stdoutSink = stdout;
288 288
289 /// A sink that writes to standard error. Errors piped to this stream will be 289 /// A sink that writes to standard error. Errors piped to this stream will be
290 /// surfaced to the top-level error handler. 290 /// surfaced to the top-level error handler.
291 final EventSink<List<int>> stderrSink = _wrapStdio(stderr, "stderr"); 291 final EventSink<List<int>> stderrSink = stderr;
292 292
293 /// Wrap the standard output or error [stream] in a [EventSink]. Any errors are 293 /// Wrap the standard output or error [stream] in a [EventSink]. Any errors are
294 /// logged, and then the program is terminated. [name] is used for debugging. 294 /// logged, and then the program is terminated. [name] is used for debugging.
295 EventSink<List<int>> _wrapStdio(IOSink sink, String name) { 295 EventSink<List<int>> _wrapStdio(IOSink sink, String name) {
nweiz 2013/04/15 19:37:23 This is no longer used; you can remove it.
nweiz 2013/04/15 19:59:52 I hadn't seen the second CL when I wrote this. I'l
296 var pair = consumerToSink(sink); 296 var pair = consumerToSink(sink);
297 pair.last.catchError((e) { 297 pair.last.catchError((e) {
298 // This log may or may not work, depending on how the stream failed. Not 298 // This log may or may not work, depending on how the stream failed. Not
299 // much we can do about that. 299 // much we can do about that.
300 log.error("Error writing to $name: $e"); 300 log.error("Error writing to $name: $e");
301 exit(exit_codes.IO); 301 exit(exit_codes.IO);
302 }); 302 });
303 return pair.first; 303 return pair.first;
304 } 304 }
305 305
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 const PubProcessResult(this.stdout, this.stderr, this.exitCode); 729 const PubProcessResult(this.stdout, this.stderr, this.exitCode);
730 730
731 bool get success => exitCode == 0; 731 bool get success => exitCode == 0;
732 } 732 }
733 733
734 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 734 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
735 Uri _getUri(uri) { 735 Uri _getUri(uri) {
736 if (uri is Uri) return uri; 736 if (uri is Uri) return uri;
737 return Uri.parse(uri); 737 return Uri.parse(uri);
738 } 738 }
OLDNEW
« no previous file with comments | « samples/build_dart_simple/build.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698