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 /// 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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 // GZIP it. 7zip doesn't support doing both as a single operation. Send | 871 // GZIP it. 7zip doesn't support doing both as a single operation. Send |
872 // the output to stdout. | 872 // the output to stdout. |
873 args = ["a", "unused", "-tgzip", "-so", tarFile]; | 873 args = ["a", "unused", "-tgzip", "-so", tarFile]; |
874 return startProcess(command, args); | 874 return startProcess(command, args); |
875 }).then((process) { | 875 }).then((process) { |
876 // Ignore 7zip's stderr. 7zip writes its normal output to stderr. We don't | 876 // Ignore 7zip's stderr. 7zip writes its normal output to stderr. We don't |
877 // want to show that since it's meaningless. | 877 // want to show that since it's meaningless. |
878 // | 878 // |
879 // TODO(rnystrom): Should log the stderr and display it if an actual error | 879 // TODO(rnystrom): Should log the stderr and display it if an actual error |
880 // occurs. | 880 // occurs. |
881 store(process.stdout, controller); | 881 return store(process.stdout, controller); |
882 }); | 882 }); |
883 }).catchError((e) { | 883 }).catchError((e) { |
884 // We don't have to worry about double-signaling here, since the store() | 884 // We don't have to worry about double-signaling here, since the store() |
885 // above will only be reached if everything succeeds. | 885 // above will only be reached if everything succeeds. |
886 controller.signalError(e.error, e.stackTrace); | 886 controller.signalError(e.error, e.stackTrace); |
887 controller.close(); | 887 controller.close(); |
888 }); | 888 }); |
889 return new ByteStream(controller.stream); | 889 return new ByteStream(controller.stream); |
890 } | 890 } |
891 | 891 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
932 Directory _getDirectory(entry) { | 932 Directory _getDirectory(entry) { |
933 if (entry is Directory) return entry; | 933 if (entry is Directory) return entry; |
934 return new Directory(entry); | 934 return new Directory(entry); |
935 } | 935 } |
936 | 936 |
937 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. | 937 /// Gets a [Uri] for [uri], which can either already be one, or be a [String]. |
938 Uri _getUri(uri) { | 938 Uri _getUri(uri) { |
939 if (uri is Uri) return uri; | 939 if (uri is Uri) return uri; |
940 return Uri.parse(uri); | 940 return Uri.parse(uri); |
941 } | 941 } |
OLD | NEW |