File tree Expand file tree Collapse file tree 2 files changed +14
-13
lines changed
Expand file tree Collapse file tree 2 files changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -132,21 +132,24 @@ int NodeMainInstance::Run(const EnvSerializeInfo* env_info) {
132132 int exit_code = 0 ;
133133 DeleteFnPtr<Environment, FreeEnvironment> env =
134134 CreateMainEnvironment (&exit_code, env_info);
135-
136135 CHECK_NOT_NULL (env);
137- {
138- Context::Scope context_scope (env->context ());
139136
140- if (exit_code == 0 ) {
141- LoadEnvironment (env.get (), StartExecutionCallback{});
137+ Context::Scope context_scope (env->context ());
138+ Run (&exit_code, env.get ());
139+ return exit_code;
140+ }
142141
143- exit_code = SpinEventLoop (env.get ()).FromMaybe (1 );
144- }
142+ void NodeMainInstance::Run (int * exit_code, Environment* env) {
143+ if (*exit_code == 0 ) {
144+ LoadEnvironment (env, StartExecutionCallback{});
145145
146- ResetStdio ();
146+ *exit_code = SpinEventLoop (env).FromMaybe (1 );
147+ }
147148
148- // TODO(addaleax): Neither NODE_SHARED_MODE nor HAVE_INSPECTOR really
149- // make sense here.
149+ ResetStdio ();
150+
151+ // TODO(addaleax): Neither NODE_SHARED_MODE nor HAVE_INSPECTOR really
152+ // make sense here.
150153#if HAVE_INSPECTOR && defined(__POSIX__) && !defined(NODE_SHARED_MODE)
151154 struct sigaction act;
152155 memset (&act, 0 , sizeof (act));
@@ -161,9 +164,6 @@ int NodeMainInstance::Run(const EnvSerializeInfo* env_info) {
161164#if defined(LEAK_SANITIZER)
162165 __lsan_do_leak_check ();
163166#endif
164- }
165-
166- return exit_code;
167167}
168168
169169DeleteFnPtr<Environment, FreeEnvironment>
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ class NodeMainInstance {
5959
6060 // Start running the Node.js instances, return the exit code when finished.
6161 int Run (const EnvSerializeInfo* env_info);
62+ void Run (int * exit_code, Environment* env);
6263
6364 IsolateData* isolate_data () { return isolate_data_.get (); }
6465
You can’t perform that action at this time.
0 commit comments