-
Notifications
You must be signed in to change notification settings - Fork 30k
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
inspector: document bad usage for --inspect-port #12581
Conversation
doc/api/cli.md
Outdated
--> | ||
|
||
Set the host:port to be used when the inspector is activated. | ||
Useful when the activating the inspector by sending the `SIGUSR1` signal. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra the
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tests. Also, I would handle it in node_debug_options.cc, not node.cc.
The only way to do that is to The structure of the code suggests to me that is not intended, but I don't understand why the debug options parsing was broken out into of the main option parsing loop in the first place. Because it was broken out into a function that returns boolean it can only indicate consumed/not consumed, and has no way of returning an error state. I could change the return to an int: 0 = consumed, 1 = not consumed, -1 means error -- but then how to return the specific error string? Add a return string arg, too? Seems a mess. |
Yes. There is at least one other exit statement in that file. |
IIRC I didn't document |
I think inspect-port is for use with SIGUSR1, ultimately, whereas --inspect=9999 will actually activate the inspector. |
node/src/node_debug_options.cc Line 29 in ef6a7cf
exit(9) ? What's with the 12 ? This and node_revert.cc seem to be the only uses of 12 in node, the other CLI arg errors I've found are 9 .
|
Exit code |
@sam-github Rebase needed. |
e779313
to
0a9a015
Compare
@bnoordhuis PTAL |
0a9a015
to
8cf9130
Compare
argh, lint error if you don't require common, lint error if you require it and don't use it. |
|
||
// Tests that node exits consistently on bad option syntax. | ||
|
||
common.noop(); // Avoid lint errors if common is not required, or not used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of doing this, you can just write require('../common');
on the line 2 and don't assign the result of require
anywhere.
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
e45f7e5
to
4a773f5
Compare
OK, nice and green, @bnoordhuis |
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 <jasnell@gmail.com>
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 <jasnell@gmail.com>
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 <jasnell@gmail.com>
I don't believe this is applicable to v6.x Please feel free to change label if I am mistaken |
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:
It is now correctly reported as requiring an argument:
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
inspector