Skip to content

Execute child.stdout.on before child.on("exit")  #224

@orbatschow

Description

@orbatschow
var shell = require('shelljs');

var child = shell.exec('node --version', {silent:true, async:true});

child.stdout.on('data', function(data) {
    console.log(data);
});

child.on("exit", function(code) {
    console.log(code);
});

child.on("error", function (error) {
console.log(error);
});

The output of this command is :

0
v1.0.4

What do i have to do, to make shelljs return all data immediately and before on exit is executed ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    execIssues specific to the shell.exec() APIfixBug/defect, or a fix for such a problem

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions