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

Unified Diff: sdk/lib/io/process.dart

Issue 11665004: Add exitCode setter to set the exit code returned by the Dart VM (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Actually upload the correct patch Created 8 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
Index: sdk/lib/io/process.dart
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index 913807d6e3226efa80e4147aac3309584e6f8560..34e0140a751a5f1585d765cc6a6f5c2a083172b0 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -8,17 +8,37 @@ part of dart.io;
// cannot patch a top-level at this point.
class _ProcessUtils {
external static _exit(int status);
+ external static _setExitCode(int status);
}
-/** Exit the Dart VM process with the given [status] code. */
+/**
+ * Exit the Dart VM process immediately with the given [status] code.
+ *
+ * This does not wait for any asynchronous operations to terminate. Using
+ * [exit] is therefore very likely to lose data.
+ */
void exit(int status) {
if (status is !int) {
- throw new ArgumentError("int status expected");
+ throw new ArgumentError("exit: int status expected");
}
_ProcessUtils._exit(status);
}
/**
+ * Global exit code for the Dart VM.
+ *
+ * The exit code is global for the Dart VM and the last assignment to
+ * exitCode from any isolate determines the exit code of the Dart VM
+ * on normal termination.
+ */
+set exitCode(int status) {
+ if (status is !int) {
+ throw new ArgumentError("setExitCode: int status expected");
+ }
+ _ProcessUtils._setExitCode(status);
+}
+
+/**
* [Process] is used to start new processes using the static
* [start] and [run] methods.
*/

Powered by Google App Engine
This is Rietveld 408576698