Skip to content

Commit

Permalink
src: add flags for controlling process behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
codebytere committed Mar 17, 2022
1 parent ff02354 commit bcd88f8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 155 deletions.
2 changes: 0 additions & 2 deletions patches/node/.patches
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ feat_initialize_asar_support.patch
expose_get_builtin_module_function.patch
build_add_gn_build_files.patch
fix_add_default_values_for_variables_in_common_gypi.patch
feat_add_flags_for_low-level_hooks_and_exceptions.patch
fix_expose_tracing_agent_and_use_tracing_tracingcontroller_instead.patch
pass_all_globals_through_require.patch
build_modify_js2c_py_to_allow_injection_of_original-fs_and_custom_embedder_js.patch
Expand All @@ -19,7 +18,6 @@ fix_allow_preventing_initializeinspector_in_env.patch
src_allow_embedders_to_provide_a_custom_pageallocator_to.patch
fix_crypto_tests_to_run_with_bssl.patch
fix_account_for_debugger_agent_race_condition.patch
add_should_read_node_options_from_env_option_to_disable_node_options.patch
repl_fix_crash_when_sharedarraybuffer_disabled.patch
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
chore_fix_-wimplicit-fallthrough.patch
Expand Down

This file was deleted.

This file was deleted.

10 changes: 6 additions & 4 deletions shell/common/node_bindings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ bool NodeBindings::IsInitialized() {
void NodeBindings::Initialize() {
TRACE_EVENT0("electron", "NodeBindings::Initialize");
// Open node's error reporting system for browser process.
node::g_upstream_node_mode = false;

#if BUILDFLAG(IS_LINUX)
// Get real command line in renderer process forked by zygote.
Expand All @@ -381,14 +380,17 @@ void NodeBindings::Initialize() {

auto env = base::Environment::Create();
SetNodeOptions(env.get());
node::Environment::should_read_node_options_from_env_ =
fuses::IsNodeOptionsEnabled();

std::vector<std::string> argv = {"electron"};
std::vector<std::string> exec_argv;
std::vector<std::string> errors;
uint64_t process_flags = node::ProcessFlags::kEnableStdioInheritance;
if (!fuses::IsNodeOptionsEnabled())
process_flags |= node::ProcessFlags::kDisableNodeOptionsEnv;

int exit_code = node::InitializeNodeWithArgs(&argv, &exec_argv, &errors);
int exit_code = node::InitializeNodeWithArgs(
&argv, &exec_argv, &errors,
static_cast<node::ProcessFlags::Flags>(process_flags));

for (const std::string& error : errors)
fprintf(stderr, "%s: %s\n", argv[0].c_str(), error.c_str());
Expand Down

0 comments on commit bcd88f8

Please sign in to comment.