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

Unified Diff: runtime/bin/main.cc

Issue 24508004: Fix VM exit code in some cases. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 3 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
===================================================================
--- runtime/bin/main.cc (revision 27923)
+++ runtime/bin/main.cc (working copy)
@@ -407,6 +407,7 @@
#define CHECK_RESULT(result) \
if (Dart_IsError(result)) { \
*error = strdup(Dart_GetError(result)); \
+ *is_compile_error = Dart_IsCompilationError(result); \
Dart_ExitScope(); \
Dart_ShutdownIsolate(); \
return NULL; \
@@ -417,7 +418,8 @@
static Dart_Isolate CreateIsolateAndSetupHelper(const char* script_uri,
const char* main,
void* data,
- char** error) {
+ char** error,
+ bool* is_compile_error) {
Dart_Isolate isolate =
Dart_CreateIsolate(script_uri, main, snapshot_buffer, data, error);
if (isolate == NULL) {
@@ -503,10 +505,12 @@
static Dart_Isolate CreateIsolateAndSetup(const char* script_uri,
const char* main,
void* data, char** error) {
+ bool is_compile_error = false;
return CreateIsolateAndSetupHelper(script_uri,
main,
new IsolateData(),
- error);
+ error,
+ &is_compile_error);
}
@@ -765,16 +769,18 @@
// Call CreateIsolateAndSetup which creates an isolate and loads up
// the specified application script.
char* error = NULL;
+ bool is_compile_error = false;
char* isolate_name = BuildIsolateName(script_name, "main");
Dart_Isolate isolate = CreateIsolateAndSetupHelper(script_name,
"main",
new IsolateData(),
- &error);
+ &error,
+ &is_compile_error);
if (isolate == NULL) {
Log::PrintErr("%s\n", error);
free(error);
delete [] isolate_name;
- return kErrorExitCode; // Indicates we encountered an error.
+ return is_compile_error ? kCompilationErrorExitCode : kErrorExitCode;
}
delete [] isolate_name;
@@ -795,7 +801,7 @@
Log::PrintErr("%s\n", Dart_GetError(result));
Dart_ExitScope();
Dart_ShutdownIsolate();
- return kErrorExitCode; // Indicates we encountered an error.
+ return DartErrorExit(result);
}
// Write the magic number to indicate file is a script snapshot.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698