Skip to content

child_process.exec not retrieving full stdout from jsdoc #3033

@Macil

Description

@Macil

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.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions