Skip to content

Commit cf2ab20

Browse files
trop[bot]codebytere
authored andcommitted
fix: dont parse arguments after a -- in the inspector (electron#14297) (electron#14338)
1 parent 6b8eba4 commit cf2ab20

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

atom/browser/node_debugger.cc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "atom/browser/node_debugger.h"
66

7+
#include <string>
8+
79
#include "base/command_line.h"
810
#include "base/strings/utf_string_conversions.h"
911
#include "libplatform/libplatform.h"
@@ -27,10 +29,15 @@ void NodeDebugger::Start() {
2729
node::DebugOptions options;
2830
for (auto& arg : base::CommandLine::ForCurrentProcess()->argv()) {
2931
#if defined(OS_WIN)
30-
options.ParseOption("Electron", base::UTF16ToUTF8(arg));
32+
const std::string nice_arg = base::UTF16ToUTF8(arg);
3133
#else
32-
options.ParseOption("Electron", arg);
34+
const std::string& nice_arg = arg;
3335
#endif
36+
// Stop handling arguments after a "--" to be consistent with Chromium
37+
if (nice_arg == "--")
38+
break;
39+
40+
options.ParseOption("Electron", nice_arg);
3441
}
3542

3643
if (options.inspector_enabled()) {

atom/common/node_bindings.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ void NodeBindings::Initialize() {
139139

140140
// Init node.
141141
// (we assume node::Init would not modify the parameters under embedded mode).
142+
// NOTE: If you change this line, please ping @codebytere or @MarshallOfSound
142143
node::Init(nullptr, nullptr, nullptr, nullptr);
143144

144145
#if defined(OS_WIN)

0 commit comments

Comments
 (0)