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

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

Issue 10966004: Fix API misuse bug I introduced when fixing another API misuse bug. :-) (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | « no previous file | 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 /** 5 /**
6 * Helper functionality to make working with IO easier. 6 * Helper functionality to make working with IO easier.
7 */ 7 */
8 #library('io'); 8 #library('io');
9 9
10 #import('dart:io'); 10 #import('dart:io');
(...skipping 594 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 destination = _getPath(destination); 605 destination = _getPath(destination);
606 606
607 if (Platform.operatingSystem == "windows") { 607 if (Platform.operatingSystem == "windows") {
608 return _extractTarGzWindows(stream, destination); 608 return _extractTarGzWindows(stream, destination);
609 } 609 }
610 610
611 var process = Process.start("tar", 611 var process = Process.start("tar",
612 ["--extract", "--gunzip", "--directory", destination]); 612 ["--extract", "--gunzip", "--directory", destination]);
613 var completer = new Completer<int>(); 613 var completer = new Completer<int>();
614 614
615 process.onExit = completer.complete;
616 process.onError = completer.completeException;
617
615 // Wait for the process to be fully started before writing to its 618 // Wait for the process to be fully started before writing to its
616 // stdin stream. 619 // stdin stream.
617 process.onStart = () { 620 process.onStart = () {
618 stream.pipe(process.stdin); 621 stream.pipe(process.stdin);
619 process.stdout.pipe(stdout, close: false); 622 process.stdout.pipe(stdout, close: false);
620 process.stderr.pipe(stderr, close: false); 623 process.stderr.pipe(stderr, close: false);
621
622 process.onExit = completer.complete;
623 process.onError = completer.completeException;
624 }; 624 };
625 625
626 return completer.future.transform((exitCode) => exitCode == 0); 626 return completer.future.transform((exitCode) => exitCode == 0);
627 } 627 }
628 628
629 Future<bool> _extractTarGzWindows(InputStream stream, String destination) { 629 Future<bool> _extractTarGzWindows(InputStream stream, String destination) {
630 // Find 7zip. 630 // Find 7zip.
631 var scriptDir = new Path(new Options().script).directoryPath; 631 var scriptDir = new Path(new Options().script).directoryPath;
632 632
633 // Note: This line of code gets munged by create_sdk.py to be the correct 633 // Note: This line of code gets munged by create_sdk.py to be the correct
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 return new Directory(entry); 706 return new Directory(entry);
707 } 707 }
708 708
709 /** 709 /**
710 * Gets a [Uri] for [uri], which can either already be one, or be a [String]. 710 * Gets a [Uri] for [uri], which can either already be one, or be a [String].
711 */ 711 */
712 Uri _getUri(uri) { 712 Uri _getUri(uri) {
713 if (uri is Uri) return uri; 713 if (uri is Uri) return uri;
714 return new Uri.fromString(uri); 714 return new Uri.fromString(uri);
715 } 715 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698