-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
debugger: make listen address configurable
`--debug=1.2.3.4:5678` and `--debug=example.com:5678` are now accepted, likewise the `--debug-brk` and `--debug-port` switch. The latter is now something of a misnomer but it's undocumented and for internal use only so it shouldn't matter too much. `--inspect=1.2.3.4:5678` and `--inspect=example.com:5678` are also accepted but don't use the host name yet; they still bind to the default address. Fixes: #3306 PR-URL: #3316 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Trevor Norris <[email protected]>
- Loading branch information
1 parent
1b1bf4e
commit 0624e51
Showing
10 changed files
with
124 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const spawn = require('child_process').spawn; | ||
|
||
let run = () => {}; | ||
function test(args, re) { | ||
const next = run; | ||
run = () => { | ||
const options = {encoding: 'utf8'}; | ||
const proc = spawn(process.execPath, args.concat(['-e', '0']), options); | ||
let stderr = ''; | ||
proc.stderr.setEncoding('utf8'); | ||
proc.stderr.on('data', (data) => { | ||
stderr += data; | ||
if (re.test(stderr)) proc.kill(); | ||
}); | ||
proc.on('exit', common.mustCall(() => { | ||
assert(re.test(stderr)); | ||
next(); | ||
})); | ||
}; | ||
} | ||
|
||
test(['--debug-brk'], /Debugger listening on (\[::\]|0\.0\.0\.0):5858/); | ||
test(['--debug-brk=1234'], /Debugger listening on (\[::\]|0\.0\.0\.0):1234/); | ||
test(['--debug-brk=127.0.0.1'], /Debugger listening on 127\.0\.0\.1:5858/); | ||
test(['--debug-brk=127.0.0.1:1234'], /Debugger listening on 127\.0\.0\.1:1234/); | ||
test(['--debug-brk=localhost'], | ||
/Debugger listening on (\[::\]|127\.0\.0\.1):5858/); | ||
test(['--debug-brk=localhost:1234'], | ||
/Debugger listening on (\[::\]|127\.0\.0\.1):1234/); | ||
|
||
if (common.hasIPv6) { | ||
test(['--debug-brk=::'], /Debug port must be in range 1024 to 65535/); | ||
test(['--debug-brk=::0'], /Debug port must be in range 1024 to 65535/); | ||
test(['--debug-brk=::1'], /Debug port must be in range 1024 to 65535/); | ||
test(['--debug-brk=[::]'], /Debugger listening on \[::\]:5858/); | ||
test(['--debug-brk=[::0]'], /Debugger listening on \[::\]:5858/); | ||
test(['--debug-brk=[::]:1234'], /Debugger listening on \[::\]:1234/); | ||
test(['--debug-brk=[::0]:1234'], /Debugger listening on \[::\]:1234/); | ||
test(['--debug-brk=[::ffff:127.0.0.1]:1234'], | ||
/Debugger listening on \[::ffff:127\.0\.0\.1\]:1234/); | ||
} | ||
|
||
run(); // Runs tests in reverse order. |