@@ -308,27 +308,6 @@ MaybeLocal<Value> Environment::BootstrapNode() {
308308 return scope.EscapeMaybe (result);
309309 }
310310
311- auto thread_switch_id =
312- is_main_thread () ? " internal/bootstrap/switches/is_main_thread"
313- : " internal/bootstrap/switches/is_not_main_thread" ;
314- result =
315- ExecuteBootstrapper (this , thread_switch_id, &node_params, &node_args);
316-
317- if (result.IsEmpty ()) {
318- return scope.EscapeMaybe (result);
319- }
320-
321- auto process_state_switch_id =
322- owns_process_state ()
323- ? " internal/bootstrap/switches/does_own_process_state"
324- : " internal/bootstrap/switches/does_not_own_process_state" ;
325- result = ExecuteBootstrapper (
326- this , process_state_switch_id, &node_params, &node_args);
327-
328- if (result.IsEmpty ()) {
329- return scope.EscapeMaybe (result);
330- }
331-
332311 Local<String> env_string = FIXED_ONE_BYTE_STRING (isolate_, " env" );
333312 Local<Object> env_var_proxy;
334313 if (!CreateEnvVarProxy (context (), isolate_, current_callback_data ())
@@ -393,6 +372,27 @@ MaybeLocal<Value> StartExecution(Environment* env, const char* main_script_id) {
393372 ->GetFunction (env->context ())
394373 .ToLocalChecked ()};
395374
375+ MaybeLocal<Value> result;
376+ auto thread_switch_id =
377+ env->is_main_thread () ? " internal/bootstrap/switches/is_main_thread"
378+ : " internal/bootstrap/switches/is_not_main_thread" ;
379+ result = ExecuteBootstrapper (env, thread_switch_id, ¶meters, &arguments);
380+
381+ if (result.IsEmpty ()) {
382+ return scope.EscapeMaybe (result);
383+ }
384+
385+ auto process_state_switch_id =
386+ env->owns_process_state ()
387+ ? " internal/bootstrap/switches/does_own_process_state"
388+ : " internal/bootstrap/switches/does_not_own_process_state" ;
389+ result = ExecuteBootstrapper (
390+ env, process_state_switch_id, ¶meters, &arguments);
391+
392+ if (result.IsEmpty ()) {
393+ return scope.EscapeMaybe (result);
394+ }
395+
396396 return scope.EscapeMaybe (
397397 ExecuteBootstrapper (env, main_script_id, ¶meters, &arguments));
398398}
0 commit comments