Index: sdk/lib/io/process.dart |
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart |
index 8ceb41d9e7d16a61d188b22901800cdfadccc91d..1c9fddb985eef94ae8147aaf5bf6b6f010d6c014 100644 |
--- a/sdk/lib/io/process.dart |
+++ b/sdk/lib/io/process.dart |
@@ -46,7 +46,11 @@ set exitCode(int status) { |
* in a isolate while it is blocked in a [sleep] call. |
*/ |
void sleep(Duration duration) { |
- _ProcessUtils._sleep(duration.inMilliseconds); |
+ int milliseconds = duration.inMilliseconds; |
+ if (milliseconds < 0) { |
+ throw new ArgumentError("sleep: duration cannot be negative"); |
+ } |
+ _ProcessUtils._sleep(milliseconds); |
} |
/** |