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

Unified Diff: utils/pub/io.dart

Issue 11785028: Commit Martin's patch for pub + lib_v2. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Revise. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « utils/pub/http.dart ('k') | utils/pub/log.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: utils/pub/io.dart
diff --git a/utils/pub/io.dart b/utils/pub/io.dart
index cc8902c3ac46feaa997bc2d02e5f585bd01517fc..2adef022262952f3ba53a196093974b6cf17279b 100644
--- a/utils/pub/io.dart
+++ b/utils/pub/io.dart
@@ -281,8 +281,8 @@ Future<List<String>> listDir(dir,
contents.add(join(dir, basename(file)));
};
- return completer.future.chain((contents) {
- return Futures.wait(children).transform((childContents) {
+ return completer.future.then((contents) {
+ return Futures.wait(children).then((childContents) {
contents.addAll(flatten(childContents));
return contents;
});
@@ -346,14 +346,14 @@ Future _attemptRetryable(Future callback()) {
var attempts = 0;
makeAttempt(_) {
attempts++;
- return callback().transformException((e) {
+ return callback().catchError((e) {
if (attempts >= 10) {
throw 'Could not complete operation. Gave up after $attempts attempts.';
}
// Wait a bit and try again.
log.fine("Operation failed, retrying (attempt $attempts).");
- return sleep(500).chain(makeAttempt);
+ return sleep(500).then(makeAttempt);
});
}
@@ -448,7 +448,7 @@ final _stringStdin = new StringInputStream(stdin);
Future<bool> confirm(String message) {
log.fine('Showing confirm message: $message');
stdout.writeString("$message (y/n)? ");
- return readLine().transform((line) => new RegExp(r"^[yY]").hasMatch(line));
+ return readLine().then((line) => new RegExp(r"^[yY]").hasMatch(line));
}
/// Returns a single line read from a [StringInputStream]. By default, reads
@@ -698,7 +698,7 @@ Future withTempDir(Future fn(String path)) {
tempDir = dir;
return fn(tempDir.path);
});
- future.catchError((_) {}).then(_) {
+ future.catchError((_) {}).then((_) {
log.fine('Cleaning up temp directory ${tempDir.path}.');
deleteDir(tempDir);
});
@@ -912,12 +912,12 @@ InputStream createTarGz(List contents, {baseDir}) {
// directory explicitly here intentionally. The former ensures that the
// files added to the archive have the correct relative path in the archive.
// The latter enables relative paths in the "-i" args to be resolved.
- return runProcess(command, args, workingDir: baseDir).chain((_) {
+ return runProcess(command, args, workingDir: baseDir).then((_) {
// GZIP it. 7zip doesn't support doing both as a single operation. Send
// the output to stdout.
args = ["a", "unused", "-tgzip", "-so", tarFile];
return startProcess(command, args);
- }).chain((process) {
+ }).then((process) {
// Drain and discard 7zip's stderr. 7zip writes its normal output to
// stderr. We don't want to show that since it's meaningless.
// TODO(rnystrom): Should log this and display it if an actual error
« no previous file with comments | « utils/pub/http.dart ('k') | utils/pub/log.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698