Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign updoc: add code example to inspector.url() method #29496
Conversation
This comment has been minimized.
This comment has been minimized.
|
ping @Trott |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
@nodejs/documentation How do we feel about this sample code? It's not really a runnable code sample. It's really just "Here's what the output would be with three completely different invocations of Node.js." I'm OK with this because it's probably still an improvement over the current doc. But there's probably an even better way to show this that doesn't suggest that the value can change within a single process when it won't? |
This comment has been minimized.
This comment has been minimized.
|
@Trott I'm not part of documentation working group, but I could change that JS sintax to Shell, so instead of: // Node.js process was called with --inspect flag.
require('inspector').url()
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72Could be more like: $ node --inspect -p "require('inspector').url()"
Debugger listening on ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72
For help see https://nodejs.org/en/docs/inspector
ws://127.0.0.1:9229/136e8c71-8901-43d8-b666-1d74a161cd72 |
This comment has been minimized.
This comment has been minimized.
I could see that being a good option, especially if the commands in question work verbatim on Windows. |
This comment has been minimized.
This comment has been minimized.
|
I'm not a Windows expert, but, I'd love to see the @nodejs/documentation opinions before making a new change, but yeah! I can change this for making this better. |
This comment has been minimized.
This comment has been minimized.
I'm not a Windows expert, but I think those commands would work on Windows too. @nodejs/platform-windows |
This comment was marked as outdated.
This comment was marked as outdated.
|
Going to land this as-is (if CI passes) because it's an improvement to our current docs, but would love to see the suggested further improvements implemented and reviewed in another PR! Thanks for this one! |
This comment has been minimized.
This comment has been minimized.
|
I found something: "Return the URL of the active inspector, or "Return the URL of the active inspector, |
This comment has been minimized.
This comment has been minimized.
|
Pong @Trott |
| @@ -52,6 +52,21 @@ parameter usage. | |||
|
|
|||
| Return the URL of the active inspector, or `undefined` if there is none. | |||
|
|
|||
| ```console | |||
| $ node --inspect -p "require('inspector').url()" | |||
This comment has been minimized.
This comment has been minimized.
Trott
Oct 3, 2019
Member
Since built-in modules are automatically loaded when Node.js is run this way, we could consider simplifying to something like this here and below?:
| $ node --inspect -p "require('inspector').url()" | |
| $ node --inspect -p 'inspector.url()' |
This comment has been minimized.
This comment has been minimized.
Trott
Oct 3, 2019
Member
And adding to the suggested change above, we can make the output easier to read by making it clear what part of the output is from inspector.url() since there are a couple other lines of output that might confuse the reader?:
| $ node --inspect -p "require('inspector').url()" | |
| $ node --inspect -p '`\ninspector.url() result: ${inspector.url()}\n`'``` |
That makes the command line a little bit harder to read, but the output easier to read, so...
¯\(ツ)/¯
This comment has been minimized.
This comment has been minimized.
|
My comments above are suggestions only. If someone wants to run this on CI and land it as it is right now, I'm fine with that. |
This comment has been minimized.
This comment has been minimized.
|
Ping @Trott, I think this is ready, is it? |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
Landed in 4113601 |
PR-URL: nodejs#29496 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Michaël Zasso <targos@protonmail.com>
juanarbol commentedSep 8, 2019
Checklist