Skip to content

Encoding of child_process.exec.stdout changed from String to Buffer in v6.2.1 #7342

Description

@sometimeskind
  • Version: v6.2.1
  • Platform: Darwin Kernel Version 15.5.0
  • Subsystem: child_process

Somewhere between node v6.2.0 and v6.2.1 the encoding of the data passed to the 'on data' callback for the child_process.exec.stdout stream seems to have changed from String to Buffer.

Was this an intentional change, and what is the recommended way of setting the encoding for the exec stdout/stdio stream?

Thanks

Code example:

var exec = require('child_process').exec;
var keepAlive = setInterval(() => {}, 1000000000);
var e = exec('ls');
e.stdout.on('data', function(data) {
  console.log('data: ', typeof data, data instanceof Buffer);
  clearInterval(keepAlive);
});

with v6.2.0, output is data: string false
with v6.2.1, output is data: object true

No activity

Activity on this issue will appear here.

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

    child_processIssues and PRs related to the child_process subsystem.confirmed-bugIssues and PRs for confirmed bugs.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions