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

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

Issue 11881030: No longer work around issue 7761. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | « pkg/http/lib/src/utils.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) 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 /// 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 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 // Writing empty data to a closed stream can cause errors. 603 // Writing empty data to a closed stream can cause errors.
604 if (data.isEmpty) return; 604 if (data.isEmpty) return;
605 605
606 // TODO(nweiz): remove this try/catch when issue 7836 is fixed. 606 // TODO(nweiz): remove this try/catch when issue 7836 is fixed.
607 try { 607 try {
608 _outputStream.write(data); 608 _outputStream.write(data);
609 } catch (e, stack) { 609 } catch (e, stack) {
610 if (!completed) completer.completeError(e, stack); 610 if (!completed) completer.completeError(e, stack);
611 completed = true; 611 completed = true;
612 } 612 }
613 }, onDone: () { 613 }, onDone: () => _outputStream.close());
614 _outputStream.close();
615 // TODO(nweiz): wait until _outputStream.onClosed is called once issue
616 // 7761 is fixed.
617 if (!completed) completer.complete(null);
618 completed = true;
619 });
620 614
621 _outputStream.onError = (e) { 615 _outputStream.onError = (e) {
622 if (!completed) completer.completeError(e); 616 if (!completed) completer.completeError(e);
623 completed = true; 617 completed = true;
624 }; 618 };
625 619
620 _outputStream.onClosed = () {
621 if (!completed) completer.complete();
622 completed = true;
623 };
624
626 return completer.future; 625 return completer.future;
627 } 626 }
628 } 627 }
629 628
630 /// Spawns and runs the process located at [executable], passing in [args]. 629 /// Spawns and runs the process located at [executable], passing in [args].
631 /// Returns a [Future] that will complete with the results of the process after 630 /// Returns a [Future] that will complete with the results of the process after
632 /// it has ended. 631 /// it has ended.
633 /// 632 ///
634 /// The spawned process will inherit its parent's environment variables. If 633 /// The spawned process will inherit its parent's environment variables. If
635 /// [environment] is provided, that will be used to augment (not replace) the 634 /// [environment] is provided, that will be used to augment (not replace) the
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 Directory _getDirectory(entry) { 1027 Directory _getDirectory(entry) {
1029 if (entry is Directory) return entry; 1028 if (entry is Directory) return entry;
1030 return new Directory(entry); 1029 return new Directory(entry);
1031 } 1030 }
1032 1031
1033 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. 1032 /// Gets a [Uri] for [uri], which can either already be one, or be a [String].
1034 Uri _getUri(uri) { 1033 Uri _getUri(uri) {
1035 if (uri is Uri) return uri; 1034 if (uri is Uri) return uri;
1036 return new Uri.fromString(uri); 1035 return new Uri.fromString(uri);
1037 } 1036 }
OLDNEW
« no previous file with comments | « pkg/http/lib/src/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698