Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Fix child process docs #8639

Closed
wants to merge 7 commits into from
Closed

Fix child process docs #8639

wants to merge 7 commits into from

Conversation

sam-github
Copy link

Fix a number of outright errors in child process documentation, as well as improve the general readability of it by using hyperlinks, documenting defaults, ordering the docs consistently, etc.

@sam-github
Copy link
Author

ping

`cwd` allows you to specify the working directory from which the process is spawned.
Use `env` to specify environment variables that will be visible to the new process.
Use `cwd` to specify the working directory from which the process is spawned,
the default is the current working diretory.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/diretory/directory/g

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably split the two clauses -- "cwd specifies the working directory of the process to be spawned. If not given, the default is the working directory of the parent process".

@chrisdickinson
Copy link

Great work! I feel that some parts may need a little clarification / modification; but I'm generally +1 on this change.

@sam-github
Copy link
Author

Thanks for the comments, @chrisdickinson, I'll fix up and ping you.

@sam-github
Copy link
Author

@chrisdickinson ping

@@ -90,29 +90,71 @@ Messages send by `.send(message, [sendHandle])` are obtained using the
* {Stream object}

A `Writable Stream` that represents the child process's `stdin`.
Closing this stream via `end()` often causes the child process to terminate.
If the child is waiting to read all it's input, it will not continue until this

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/it's/its/g

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't like the "delete the entire line" option?

@chrisdickinson
Copy link

Thanks for bearing with me on this :)

The example is not correct, and hasn't been since at least v0.10. Exec
errors are emitted as an error event, and documented as such in the
'error' event section.
env was documented as not being process.env under some condtions, which
is no longer correct.
Default was perhaps obvious, but not documented.
The lack of hyperlinks requires scrolling past pages of examples to find
the options documentation, the default value of the 'stdio' option was
not documented, and the documentation was not ordered readably.
Someone must have been confused by how pipes work, but this explanatory
text is worse than nothing, it implies that ending stdin will cause
child processes to terminate, which isn't true for the vast majority of
them.
@sam-github
Copy link
Author

OK, I rebased, and removed the text describing some of the mechanisms child node processes can use to interact with their parent. Its not specific to child_process, its not clear to me if pipe even works on Windows for non-stdio, so I'm not the one to describe that feature, at least ATM.

The rest of the PR doesn't depend on this paragraph.

@chrisdickinson
Copy link

This looks great to me! Thanks very much. Going to leave this open till EOD (5PM PST) tomorrow for other folks to look at, and if there are no objections, I'll merge then.

/cc @bnoordhuis @indutny @tjfontaine

@bnoordhuis
Copy link
Member

I looked at the changes a while ago. No comments.

chrisdickinson pushed a commit that referenced this pull request Nov 19, 2014
- Add hyperlinks from spawn options to subsections detailing what
those options do.
- Clarify some verbiage around ChildProcess.prototype.std{in,out,err}.
- Remove second-person pronoun.

PR-URL: #8639
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
@chrisdickinson
Copy link

Merged in 3a08b7c. Thanks!

@sam-github
Copy link
Author

@chrisdickinson thanks for your careful proof-reading.

FWIW, new net.Socket({fd: X}) should work on Windows, or so says @piscisaureus, I'll try and track down why it does not, when I can get a moment.

@sam-github sam-github deleted the fix-child-process-docs branch November 19, 2014 17:54
@sam-github
Copy link
Author

@chrisdickinson Just to confirm, this will hit v0.12 eventually, right? My assumption is that PRs should be targetted at the oldest maintained branch they apply to, but I don't want this lost.

mscdex pushed a commit to mscdex/node that referenced this pull request Dec 25, 2014
- Add hyperlinks from spawn options to subsections detailing what
those options do.
- Clarify some verbiage around ChildProcess.prototype.std{in,out,err}.
- Remove second-person pronoun.

PR-URL: nodejs#8639
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>
piscisaureus pushed a commit to piscisaureus/node2 that referenced this pull request Jan 10, 2015
- Add hyperlinks from spawn options to subsections detailing what
those options do.
- Clarify some verbiage around ChildProcess.prototype.std{in,out,err}.
- Remove second-person pronoun.

PR-URL: nodejs/node-v0.x-archive#8639
Reviewed-by: Chris Dickinson <christopher.s.dickinson@gmail.com>

Cherry-picked-from: nodejs/node-v0.x-archive@3a08b7c3e0bc6757e70889196
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants