Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pass the correct HostPort into the node inspector (backport: 5-0-x) #17439

Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

fix: pass the correct HostPort into the node inspector

Fixes #17348
  • Loading branch information...
MarshallOfSound authored and electron-bot committed Mar 14, 2019
commit 722809e081fb9f54e0fdabc4e8a8336cf63b6d84
@@ -60,7 +60,8 @@ void NodeDebugger::Start() {
}

const char* path = "";
if (inspector->Start(path, options, env_->inspector_host_port(),
if (inspector->Start(path, options,
std::make_shared<node::HostPort>(options.host_port),
true /* is_main */))
DCHECK(env_->inspector_agent()->IsListening());
}
@@ -257,6 +257,34 @@ describe('node feature', () => {
child.stdout.on('data', outDataHandler)
})

it('supports starting the v8 inspector with --inspect and a provided port', (done) => {
child = ChildProcess.spawn(process.execPath, ['--inspect=17364', path.join(__dirname, 'fixtures', 'module', 'run-as-node.js')], {
env: {
ELECTRON_RUN_AS_NODE: true
}
})

let output = ''
function cleanup () {
child.stderr.removeListener('data', errorDataListener)
child.stdout.removeListener('data', outDataHandler)
}
function errorDataListener (data) {
output += data
if (output.trim().startsWith('Debugger listening on ws://')) {
expect(output.trim()).to.contain(':17364', 'should be listening on port 17364')
cleanup()
done()
}
}
function outDataHandler (data) {
cleanup()
done(new Error(`Unexpected output: ${data.toString()}`))
}
child.stderr.on('data', errorDataListener)
child.stdout.on('data', outDataHandler)
})

it('does not start the v8 inspector when --inspect is after a -- argument', (done) => {
child = ChildProcess.spawn(remote.process.execPath, [path.join(__dirname, 'fixtures', 'module', 'noop.js'), '--', '--inspect'])

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.