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

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

Issue 200233002: Add exitCode getter counterpart to the existing setter in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | « sdk/lib/_internal/lib/io_patch.dart ('k') | tests/standalone/io/process_set_exit_code_script.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/process.dart
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index 828145e8304bce61369dd94fedfcd0ba7b80ab04..f90f8baa968b30f58bf195ad4a41bde6087ea840 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -9,6 +9,7 @@ part of dart.io;
class _ProcessUtils {
external static void _exit(int status);
external static void _setExitCode(int status);
+ external static int _getExitCode();
external static void _sleep(int millis);
external static int _pid(Process process);
external static Stream<ProcessSignal> _watchSignal(ProcessSignal signal);
@@ -49,22 +50,36 @@ void exit(int code) {
}
/**
- * Global exit code for the Dart VM.
+ * Set the 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.
*
+ * Default value is `0`.
+ *
* See [exit] for more information on how to chose a value for the
* exit code.
*/
-set exitCode(int code) {
+void set exitCode(int code) {
if (code is !int) {
throw new ArgumentError("Integer value for exit code expected");
}
_ProcessUtils._setExitCode(code);
}
+/*
+ * Get the 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.
+ *
+ * See [exit] for more information on how to chose a value for the
+ * exit code.
+ */
+int get exitCode => _ProcessUtils._getExitCode();
+
/**
* Sleep for the duration specified in [duration].
*
« no previous file with comments | « sdk/lib/_internal/lib/io_patch.dart ('k') | tests/standalone/io/process_set_exit_code_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698