Skip to content

Stdout is not completely flushed on process exit #2972

Description

@tschaub

The following fails with Node 4.1 (but passes on 0.12 and 0.10) on OS 10.10.5:

var assert = require('assert');
var spawn = require('child_process').spawn;

var out = new Array(Math.pow(2, 13)).join('.') + '!!';

if (process.argv[2] === '--child') {
  process.stdout.write(out);
  process.exit(0);
} else {
  var child = spawn(process.argv[0], [process.argv[1], '--child']);

  var got = '';
  child.stdout.on('data', function(data) {
    got += String(data);
  });

  child.on('exit', function() {
    assert.equal(got, out);
  });
}

The child writes 8193 bytes to stdout. The parent only gets 8192 before the exit.

See also nodejs/node-v0.x-archive#8329.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateIssues and PRs that are duplicates of other issues or PRs.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions