| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 94f237e commit bd2f127
4 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1107,14 +1107,20 @@ Module.prototype._compile = function(content, filename) { | |||
| 1107 | 1107 | if (!resolvedArgv) { | |
| 1108 | 1108 | // We enter the repl if we're not given a filename argument. | |
| 1109 | 1109 | if (process.argv[1]) { | |
| 1110 | - resolvedArgv = Module._resolveFilename(process.argv[1], null, false); | ||
| 1110 | + try { | ||
| 1111 | + resolvedArgv = Module._resolveFilename(process.argv[1], null, false); | ||
| 1112 | + } catch { | ||
| 1113 | + // We only expect this codepath to be reached in the case of a | ||
| 1114 | + // preloaded module (it will fail earlier with the main entry) | ||
| 1115 | + assert(Array.isArray(getOptionValue('--require'))); | ||
| 1116 | + } | ||
| 1111 | 1117 | } else { | |
| 1112 | 1118 | resolvedArgv = 'repl'; | |
| 1113 | 1119 | } | |
| 1114 | 1120 | } | |
| 1115 | 1121 | ||
| 1116 | 1122 | // Set breakpoint on module start | |
| 1117 | - if (!hasPausedEntry && filename === resolvedArgv) { | ||
| 1123 | + if (resolvedArgv && !hasPausedEntry && filename === resolvedArgv) { | ||
| 1118 | 1124 | hasPausedEntry = true; | |
| 1119 | 1125 | inspectorWrapper = internalBinding('inspector').callAndPauseOnStart; | |
| 1120 | 1126 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,5 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + // eslint-disable-next-line no-unused-vars | ||
| 3 | + const common = require('../common'); | ||
| 4 | + | ||
| 5 | + require.extensions['.ext'] = require.extensions['.js']; | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,29 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + common.skipIfInspectorDisabled(); | ||
| 4 | + | ||
| 5 | + // A test to ensure that preload modules are given a chance to execute before | ||
| 6 | + // resolving the main entry point with --inspect-brk active. | ||
| 7 | + | ||
| 8 | + const assert = require('assert'); | ||
| 9 | + const cp = require('child_process'); | ||
| 10 | + const path = require('path'); | ||
| 11 | + | ||
| 12 | + function test(execArgv) { | ||
| 13 | + const child = cp.spawn(process.execPath, execArgv); | ||
| 14 | + | ||
| 15 | + child.stderr.once('data', common.mustCall(function() { | ||
| 16 | + child.kill('SIGTERM'); | ||
| 17 | + })); | ||
| 18 | + | ||
| 19 | + child.on('exit', common.mustCall(function(code, signal) { | ||
| 20 | + assert.strictEqual(signal, 'SIGTERM'); | ||
| 21 | + })); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + test([ | ||
| 25 | + '--require', | ||
| 26 | + path.join(__dirname, '../fixtures/test-resolution-inspect-brk-resolver.js'), | ||
| 27 | + '--inspect-brk', | ||
| 28 | + '../fixtures/test-resolution-inspect-resolver-main.ext', | ||
| 29 | + ]); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments