mirror of https://github.com/nodejs/node.git
Reapply "debug: Wait 50ms before running the main module"
This reapplies commitpull/24503/headc781f17742
This reverts commit00224771e3
parent
cda3b6ff52
commit
8a15147bc5
21
src/node.js
21
src/node.js
|
@ -89,10 +89,31 @@
|
|||
}
|
||||
|
||||
var Module = NativeModule.require('module');
|
||||
|
||||
if (global.v8debug &&
|
||||
process.execArgv.some(function(arg) {
|
||||
return arg.match(/^--debug-brk(=[0-9]*)?$/);
|
||||
})) {
|
||||
|
||||
// XXX Fix this terrible hack!
|
||||
//
|
||||
// Give the client program a few ticks to connect.
|
||||
// Otherwise, there's a race condition where `node debug foo.js`
|
||||
// will not be able to connect in time to catch the first
|
||||
// breakpoint message on line 1.
|
||||
//
|
||||
// A better fix would be to somehow get a message from the
|
||||
// global.v8debug object about a connection, and runMain when
|
||||
// that occurs. --isaacs
|
||||
|
||||
setTimeout(Module.runMain, 50);
|
||||
|
||||
} else {
|
||||
// REMOVEME: nextTick should not be necessary. This hack to get
|
||||
// test/simple/test-exception-handler2.js working.
|
||||
// Main entry point into most programs:
|
||||
process.nextTick(Module.runMain);
|
||||
}
|
||||
|
||||
} else {
|
||||
var Module = NativeModule.require('module');
|
||||
|
|
Loading…
Reference in New Issue