From a43a292d18b21f62cb8e4484d1bf016b165ab537 Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 27 Aug 2018 10:50:23 -0700 Subject: [PATCH] fix: dont parse arguments after a -- in the inspector (#14297) --- atom/browser/node_debugger.cc | 11 +++++++++-- atom/common/node_bindings.cc | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/atom/browser/node_debugger.cc b/atom/browser/node_debugger.cc index 56e68e2b8b8..1ff17958011 100644 --- a/atom/browser/node_debugger.cc +++ b/atom/browser/node_debugger.cc @@ -4,6 +4,8 @@ #include "atom/browser/node_debugger.h" +#include + #include "base/command_line.h" #include "base/strings/utf_string_conversions.h" #include "libplatform/libplatform.h" @@ -25,10 +27,15 @@ void NodeDebugger::Start(node::MultiIsolatePlatform* platform) { node::DebugOptions options; for (auto& arg : base::CommandLine::ForCurrentProcess()->argv()) { #if defined(OS_WIN) - options.ParseOption("Electron", base::UTF16ToUTF8(arg)); + const std::string nice_arg = base::UTF16ToUTF8(arg); #else - options.ParseOption("Electron", arg); + const std::string& nice_arg = arg; #endif + // Stop handling arguments after a "--" to be consistent with Chromium + if (nice_arg == "--") + break; + + options.ParseOption("Electron", nice_arg); } // Set process._debugWaitConnect if --inspect-brk was specified to stop diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index e6aded2e661..52589228aa5 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -214,6 +214,7 @@ void NodeBindings::Initialize() { // Init node. // (we assume node::Init would not modify the parameters under embedded mode). + // NOTE: If you change this line, please ping @codebytere or @MarshallOfSound node::Init(nullptr, nullptr, nullptr, nullptr); #if defined(OS_WIN)