Index: src/d8-posix.cc |
diff --git a/src/d8-posix.cc b/src/d8-posix.cc |
index d2cf573d4c013207b62d0b35d4e68e89c24cb4bd..cdfc39cc5de77e02880fc3bced34b13f811ab867 100644 |
--- a/src/d8-posix.cc |
+++ b/src/d8-posix.cc |
@@ -772,4 +772,12 @@ void Shell::AddOSMethods(Isolate* isolate, Local<ObjectTemplate> os_templ) { |
FunctionTemplate::New(isolate, RemoveDirectory)); |
} |
+void Shell::Exit(int exit_code) { |
+ // Use _exit instead of exit to avoid races between isolate |
+ // threads and static destructors. |
+ fflush(stdout); |
+ fflush(stderr); |
+ _exit(exit_code); |
+} |
+ |
} // namespace v8 |