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

child_process.exec not retrieving full stdout from jsdoc #3033

Closed
Macil opened this issue Sep 23, 2015 · 2 comments
Closed

child_process.exec not retrieving full stdout from jsdoc #3033

Macil opened this issue Sep 23, 2015 · 2 comments
Labels
child_process Issues and PRs related to the child_process subsystem.

Comments

@Macil
Copy link

Macil commented Sep 23, 2015

Since updating from node 0.12 to node 4.1.1, I've had an issue where the stdout from jsdoc (v3.3.2) specifically captured by child_process.exec has been cut off.

var cproc = require('child_process');
cproc.exec('jsdoc aaa.js -t templates/haruki -d console -q format=json', function(err, stdout, stderr) {
  if (err || stderr) {
    console.error('err', err);
    console.error('stderr', stderr);
  }
  console.log('stdout.length', stdout.length);
});

(aaa.js, nothing special besides that its jsdoc output should be longer than 8192 bytes.)

The above program should output "stdout.length 9778", but now that I have node 4 it outputs "stdout.length 8192". If I run jsdoc aaa.js -t templates/haruki -d console -q format=json | wc -m, I get 9778 as expected, so the issue does not seem to be that jsdoc is cutting itself off.

(Note that if I run the script with node 0.12 but still use node 4.1.1 to run jsdoc, I still get the issue, so the issue does not seem to be a new regression with child_process.exec. Running the above script with either version of node and using node 0.12 to run jsdoc causes the issue to not happen. I assume some minor change in node 4 changed how the output from jsdoc is buffered in a way that triggers a longstanding child_process.exec bug if you try to read that output? Maybe it could be a bug with jsdoc, but I'm not seeing how that would likely unless jsdoc is doing something really weird.)

@mscdex mscdex added the child_process Issues and PRs related to the child_process subsystem. label Sep 23, 2015
@mscdex
Copy link
Contributor

mscdex commented Sep 23, 2015

It looks like jsdoc explicitly calls process.exit() which could be a problem if stdout/stderr writes haven't finished before process.exit() is called. See #2972.

@Macil
Copy link
Author

Macil commented Sep 23, 2015

That looks like the issue. I'll close this as it's a duplicate of that and/or an issue with jsdoc.

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.
Projects
None yet
Development

No branches or pull requests

2 participants