Skip to content

Commit

Permalink
fix: dont parse arguments after a -- in the inspector (#14297) (#14334)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckerr committed Aug 27, 2018
1 parent 7ed6e2b commit b4c5a30
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions atom/browser/node_debugger.cc
Expand Up @@ -4,6 +4,8 @@

#include "atom/browser/node_debugger.h"

#include <string>

#include "base/command_line.h"
#include "base/strings/utf_string_conversions.h"
#include "libplatform/libplatform.h"
Expand All @@ -28,10 +30,15 @@ void NodeDebugger::Start(node::NodePlatform* 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);
}

if (options.inspector_enabled()) {
Expand Down
1 change: 1 addition & 0 deletions atom/common/node_bindings.cc
Expand Up @@ -168,6 +168,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)
Expand Down

0 comments on commit b4c5a30

Please sign in to comment.