★ wanayoo — archive 1999 https://github.com/nodejs/node/pull/29496Nouvelle recherche | Portail wanayoo
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

doc: add code example to inspector.url() method #29496

Closed
wants to merge 5 commits into from

Conversation

@juanarbol
Copy link
Member

juanarbol commented Sep 8, 2019

Checklist
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
doc/api/inspector.md Outdated Show resolved Hide resolved
@cjihrig
cjihrig approved these changes Sep 9, 2019
doc/api/inspector.md Outdated Show resolved Hide resolved
@lpinca
lpinca approved these changes Sep 12, 2019
@Trott Trott force-pushed the nodejs:master branch from 1ecc406 to 49cf67e Sep 17, 2019
@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Sep 24, 2019

ping @Trott

@Trott

This comment has been minimized.

@Trott Trott added author ready and removed author ready labels Sep 25, 2019
@Trott

This comment has been minimized.

Copy link
Member

Trott commented Sep 25, 2019

@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?

@Trott Trott added the author ready label Sep 25, 2019
@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Sep 25, 2019

@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-1d74a161cd72

Could 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
@Trott

This comment has been minimized.

Copy link
Member

Trott commented Sep 26, 2019

@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-1d74a161cd72

Could 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

I could see that being a good option, especially if the commands in question work verbatim on Windows.

@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Sep 26, 2019

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.

@Trott

This comment has been minimized.

Copy link
Member

Trott commented Sep 27, 2019

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.

I'm not a Windows expert, but I think those commands would work on Windows too. @nodejs/platform-windows

@Trott

This comment was marked as outdated.

Copy link
Member

Trott commented Sep 27, 2019

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!

doc/api/inspector.md Outdated Show resolved Hide resolved
@Trott Trott removed the author ready label Sep 27, 2019
@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Sep 28, 2019

I found something: "Return the URL of the active inspector, or undefined if there is none.", and by the way, In default options, I see that, by default, debugger is 127.0.0.1:9229, maybe, maybe... say that could improves documentation:

"Return the URL of the active inspector, 127.0.0.1:9229 by default, or undefined if there is none." With better sintax, of course.

@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Oct 3, 2019

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.

Copy link
@Trott

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?:

Suggested change
$ node --inspect -p "require('inspector').url()"
$ node --inspect -p 'inspector.url()'

This comment has been minimized.

Copy link
@Trott

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?:

Suggested change
$ 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...
¯\(ツ)

@Trott

This comment has been minimized.

Copy link
Member

Trott commented Oct 3, 2019

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.

@juanarbol

This comment has been minimized.

Copy link
Member Author

juanarbol commented Oct 29, 2019

Ping @Trott, I think this is ready, is it?

@BridgeAR BridgeAR requested a review from Trott Dec 9, 2019
@targos
targos approved these changes Dec 11, 2019
@targos

This comment has been minimized.

Copy link
Member

targos commented Dec 11, 2019

Landed in 4113601

@targos targos closed this Dec 11, 2019
targos added a commit that referenced this pull request Dec 11, 2019
PR-URL: #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>
MylesBorins added a commit that referenced this pull request Dec 13, 2019
PR-URL: #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>
@MylesBorins MylesBorins mentioned this pull request Dec 13, 2019
targos added a commit that referenced this pull request Jan 14, 2020
PR-URL: #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>
BethGriggs added a commit that referenced this pull request Feb 6, 2020
PR-URL: #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>
@MylesBorins MylesBorins mentioned this pull request Feb 8, 2020
saitonakamura pushed a commit to saitonakamura/node that referenced this pull request Apr 7, 2020
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

8 participants
You can’t perform that action at this time.