#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;
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);
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);