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

node docs issue in child_process #7269

Closed
ORESoftware opened this issue Jun 10, 2016 · 4 comments
Closed

node docs issue in child_process #7269

ORESoftware opened this issue Jun 10, 2016 · 4 comments
Labels
child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations.

Comments

@ORESoftware
Copy link
Contributor

ORESoftware commented Jun 10, 2016

Using child_process.spawn, I believe the docs are incorrect (simple typo with drastic consequences) when using the stdio option:

const cp = require('child_process');
const n = cp.spawn('node',['foo.js'],{
  stdio: ['ignore','ignore','ignore'],
  detached: true
});

the above should be correct, if you wish to create a child_process that is the leader of a new process group, that won't die if the parent is killed.

However, the child_process docs have this:

https://nodejs.org/api/child_process.html#child_process_options_detached

const n = cp.spawn('node',['foo.js'],{
  stdio: ['ignore'],
  detached: true
});

I don't believe the above is correct, although this may work:

const n = cp.spawn('node',['foo.js'],{
  stdio: 'ignore',
  detached: true
});

this issue had me stuck for a few days :)

@ORESoftware
Copy link
Contributor Author

this can be tested by just seeing if the child process is still around after killing the parent

@mscdex mscdex added child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations. labels Jun 11, 2016
@Trott
Copy link
Member

Trott commented Jun 11, 2016

Would you be willing to file a pull request for this? The text to change is located in https://github.com/nodejs/node/blob/master/doc/api/child_process.md

@ORESoftware
Copy link
Contributor Author

Yeah will do, will verify that it's correct first

@cjihrig
Copy link
Contributor

cjihrig commented Jun 14, 2016

@ORESoftware I believe we do want the change you mentioned.

cjihrig added a commit to cjihrig/node that referenced this issue Jul 6, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: nodejs#7269
PR-URL: nodejs#7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
evanlucas pushed a commit that referenced this issue Jul 12, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 12, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
MylesBorins pushed a commit that referenced this issue Jul 14, 2016
The example changed by this commit uses ['ignore'] where
'ignore' is intended.

Fixes: #7269
PR-URL: #7540
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. doc Issues and PRs related to the documentations.
Projects
None yet
Development

No branches or pull requests

4 participants