diff --git a/atom/app/node_main.cc b/atom/app/node_main.cc index 8823e583107c..356fe03e139d 100644 --- a/atom/app/node_main.cc +++ b/atom/app/node_main.cc @@ -5,15 +5,18 @@ #include "atom/app/node_main.h" #include "atom/browser/javascript_environment.h" +#include "atom/browser/node_debugger.h" +#include "atom/common/node_includes.h" +#include "base/command_line.h" #include "gin/array_buffer.h" #include "gin/public/isolate_holder.h" #include "gin/v8_initializer.h" -#include "atom/common/node_includes.h" - namespace atom { int NodeMain(int argc, char *argv[]) { + base::CommandLine::Init(argc, argv); + argv = uv_setup_args(argc, argv); int exec_argc; const char** exec_argv; @@ -31,17 +34,13 @@ int NodeMain(int argc, char *argv[]) { gin_env.isolate(), uv_default_loop(), gin_env.context(), argc, argv, exec_argc, exec_argv); - // Start debugger. - node::node_isolate = gin_env.isolate(); - if (node::use_debug_agent) - node::StartDebug(env, node::debug_wait_connect); + // Start our custom debugger implementation. + NodeDebugger node_debugger(gin_env.isolate()); + if (node_debugger.IsRunning()) + env->AssignToContext(v8::Debug::GetDebugContext()); node::LoadEnvironment(env); - // Enable debugger. - if (node::use_debug_agent) - node::EnableDebug(env); - bool more; do { more = uv_run(env->event_loop(), UV_RUN_ONCE); diff --git a/atom/common/node_bindings.cc b/atom/common/node_bindings.cc index 827033bbccbc..e6d59f2ed366 100644 --- a/atom/common/node_bindings.cc +++ b/atom/common/node_bindings.cc @@ -137,11 +137,6 @@ void NodeBindings::Initialize() { AtomCommandLine::InitializeFromCommandLine(); #endif - // Parse the debug args. - auto args = AtomCommandLine::argv(); - for (const std::string& arg : args) - node::ParseDebugOpt(arg.c_str()); - // Init node. // (we assume node::Init would not modify the parameters under embedded mode). node::Init(nullptr, nullptr, nullptr, nullptr);