Index: runtime/bin/process.cc |
diff --git a/runtime/bin/process.cc b/runtime/bin/process.cc |
index 2c90c11cdbebc29c364aaea4675c86cfc5b14c30..c678dfc4c8b944498eaf0fb971c6ccd048981beb 100644 |
--- a/runtime/bin/process.cc |
+++ b/runtime/bin/process.cc |
@@ -4,6 +4,7 @@ |
#include "bin/dartutils.h" |
#include "bin/io_buffer.h" |
+#include "bin/log.h" |
#include "bin/platform.h" |
#include "bin/process.h" |
#include "bin/socket.h" |
@@ -216,8 +217,13 @@ void FUNCTION_NAME(Process_Exit)(Dart_NativeArguments args) { |
int64_t status = 0; |
// Ignore result if passing invalid argument and just exit 0. |
DartUtils::GetInt64Value(Dart_GetNativeArgument(args, 0), &status); |
- Dart_ExitIsolate(); |
- Dart_Cleanup(); |
+ Dart_ShutdownIsolate(); |
+ Process::TerminateExitCodeHandler(); |
+ char* error = Dart_Cleanup(); |
+ if (error != NULL) { |
+ Log::PrintErr("VM cleanup failed: %s\n", error); |
+ free(error); |
+ } |
exit(static_cast<int>(status)); |
} |