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

Unified Diff: runtime/bin/process.cc

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: Address comments. 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
« no previous file with comments | « runtime/bin/process.h ('k') | runtime/bin/process_patch.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process.cc
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc
index 740e4a4e5011a6ba8b7582083e18e88cae38b5d3..81715ba71903eaa0cef4ba57eaa11fd5272f3d64 100644
--- a/runtime/bin/process.cc
+++ b/runtime/bin/process.cc
@@ -12,6 +12,8 @@
static const int kProcessIdNativeField = 0;
+int Process::global_exit_code_ = 0;
+dart::Mutex Process::global_exit_code_mutex_;
// Extract an array of C strings from a list of Dart strings.
static char** ExtractCStringList(Dart_Handle strings,
@@ -168,6 +170,26 @@ void FUNCTION_NAME(Process_Kill)(Dart_NativeArguments args) {
}
+void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ int64_t status = 0;
+ // Ignore result if passing invalid argument and just exit 0.
+ DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
+ Dart_ExitScope();
+ exit(static_cast<int>(status));
+}
+
+
+void FUNCTION_NAME(Process_SetExitCode)(Dart_NativeArguments args) {
+ Dart_EnterScope();
+ int64_t status = 0;
+ // Ignore result if passing invalid argument and just set exit code to 0.
+ DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status);
+ Process::SetGlobalExitCode(status);
+ Dart_ExitScope();
+}
+
+
Dart_Handle Process::GetProcessIdNativeField(Dart_Handle process,
intptr_t* pid) {
return Dart_GetNativeInstanceField(process, kProcessIdNativeField, pid);
« no previous file with comments | « runtime/bin/process.h ('k') | runtime/bin/process_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698