-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
inspector: document bad usage for --inspect-port
Document --inspect-port, and fix the reporting for when it is misused. The option requires an argument, but when the argument was omitted, the error message incorrectly reported --inspect-port as being bad, as if was not supported at all: % node --inspect-port node: bad option: --inspect-port % node --none-such node: bad option: --none-such It is now correctly reported as requiring an argument: % ./node --inspect-port ./node: --inspect-port requires an argument PR-URL: #12581 Reviewed-By: James M Snell <[email protected]>
- Loading branch information
1 parent
d4e9e0f
commit 39785c7
Showing
6 changed files
with
57 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
'use strict'; | ||
require('../common'); | ||
|
||
// Tests that node exits consistently on bad option syntax. | ||
|
||
const assert = require('assert'); | ||
const spawn = require('child_process').spawnSync; | ||
|
||
requiresArgument('--inspect-port'); | ||
requiresArgument('--inspect-port='); | ||
requiresArgument('--debug-port'); | ||
requiresArgument('--debug-port='); | ||
requiresArgument('--eval'); | ||
|
||
function requiresArgument(option) { | ||
const r = spawn(process.execPath, [option], {encoding: 'utf8'}); | ||
|
||
assert.strictEqual(r.status, 9); | ||
|
||
const msg = r.stderr.split(/\r?\n/)[0]; | ||
assert.strictEqual(msg, process.execPath + ': ' + option + | ||
' requires an argument'); | ||
} |