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

Unified Diff: sdk/lib/_internal/pub/lib/src/io.dart

Issue 94843002: Unify dart:async and pub/io.dart TimeoutException classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years 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 | « sdk/lib/_internal/pub/lib/src/http.dart ('k') | sdk/lib/_internal/pub/lib/src/log.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub/lib/src/io.dart
diff --git a/sdk/lib/_internal/pub/lib/src/io.dart b/sdk/lib/_internal/pub/lib/src/io.dart
index 90b06f9aebf8670929df79aca3925ea430bf927e..88779aeb69b409e1dad6e50b1c167098554902fa 100644
--- a/sdk/lib/_internal/pub/lib/src/io.dart
+++ b/sdk/lib/_internal/pub/lib/src/io.dart
@@ -5,7 +5,7 @@
/// Helper functionality to make working with IO easier.
library pub.io;
-import 'dart:async' hide TimeoutException;
+import 'dart:async';
import 'dart:collection';
import 'dart:convert';
import 'dart:io';
@@ -630,10 +630,12 @@ Future _doProcess(Function fn, String executable, List<String> args,
/// Note that timing out will not cancel the asynchronous operation behind
/// [input].
Future timeout(Future input, int milliseconds, String description) {
+ // TODO(nwiez): Replace this with [Future.timeout].
var completer = new Completer();
- var timer = new Timer(new Duration(milliseconds: milliseconds), () {
+ var duration = new Duration(milliseconds: milliseconds);
+ var timer = new Timer(duration, () {
completer.completeError(new TimeoutException(
- 'Timed out while $description.'),
+ 'Timed out while $description.', duration),
new Trace.current());
});
input.then((value) {
@@ -816,15 +818,6 @@ ByteStream createTarGz(List contents, {baseDir}) {
return new ByteStream(controller.stream);
}
-/// Exception thrown when an operation times out.
-class TimeoutException implements Exception {
- final String message;
-
- const TimeoutException(this.message);
-
- String toString() => message;
-}
-
/// Contains the results of invoking a [Process] and waiting for it to complete.
class PubProcessResult {
final List<String> stdout;
« no previous file with comments | « sdk/lib/_internal/pub/lib/src/http.dart ('k') | sdk/lib/_internal/pub/lib/src/log.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698