Merge pull request #7001 from electron/debug-wait-connect

Port --debug-brk support to Node 6.3.0
This commit is contained in:
Cheng Zhao 2016-08-29 15:15:14 +09:00 committed by GitHub
commit ac9e64cfd4
2 changed files with 7 additions and 5 deletions

View file

@ -34,11 +34,6 @@ void JavascriptEnvironment::OnMessageLoopDestroying() {
bool JavascriptEnvironment::Initialize() { bool JavascriptEnvironment::Initialize() {
auto cmd = base::CommandLine::ForCurrentProcess(); auto cmd = base::CommandLine::ForCurrentProcess();
if (cmd->HasSwitch("debug-brk")) {
// Need to be called before v8::Initialize().
const char expose_debug_as[] = "--expose_debug_as=v8debug";
v8::V8::SetFlagsFromString(expose_debug_as, sizeof(expose_debug_as) - 1);
}
// --js-flags. // --js-flags.
std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags); std::string js_flags = cmd->GetSwitchValueASCII(switches::kJavaScriptFlags);

View file

@ -185,6 +185,13 @@ node::Environment* NodeBindings::CreateEnvironment(
base::FilePath helper_exec_path; base::FilePath helper_exec_path;
PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path); PathService::Get(content::CHILD_PROCESS_EXE, &helper_exec_path);
process.Set("helperExecPath", helper_exec_path); process.Set("helperExecPath", helper_exec_path);
// Set process._debugWaitConnect if --debug-brk was specified to stop
// the debugger on the first line
if (is_browser_ &&
base::CommandLine::ForCurrentProcess()->HasSwitch("debug-brk"))
process.Set("_debugWaitConnect", true);
return env; return env;
} }