Browse Source

module: fix --debug-brk on symlinked scripts

* fixes #1519
v0.7.4-release
Fedor Indutny 13 years ago
parent
commit
27c85727ed
  1. 16
      lib/module.js

16
lib/module.js

@ -360,6 +360,11 @@ Module.prototype.require = function(path) {
};
// Resolved path to process.argv[1] will be lazily placed here
// (needed for setting breakpoint when called with --debug-brk)
var resolvedArgv;
// Returns exception if any
Module.prototype._compile = function(content, filename) {
var self = this;
@ -427,8 +432,15 @@ Module.prototype._compile = function(content, filename) {
var wrapper = Module.wrap(content);
var compiledWrapper = runInThisContext(wrapper, filename, true);
if (filename === process.argv[1] && global.v8debug) {
global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
if (global.v8debug) {
if (!resolvedArgv) {
resolvedArgv = Module._resolveFilename(process.argv[1], null)[1];
}
// Set breakpoint on module start
if (filename === resolvedArgv) {
global.v8debug.Debug.setBreakPoint(compiledWrapper, 0, 0);
}
}
var args = [self.exports, require, self, filename, dirname];
return compiledWrapper.apply(self.exports, args);

Loading…
Cancel
Save