Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

child_process.spawn() piping

node v5.12.0
version: 2.0.0
endpointsharetweet
Without process.exit();
var child_process = require('child_process'); var cmd = 'ls'; var value = ['-z', '/usr']; var opt = { }; var child = child_process.spawn(cmd, value, opt); child.stdout.on('data', function (data) { console.log("IM HERE"); console.log('data' + data); }); child.stderr.on('data', function (data) { console.log("IM HERE - Error"); console.log('test: ' + data); }); child.on('close', function (code) { console.log("IM HERE"); console.log("close"); });
With process.exit();
var child_process = require('child_process'); var cmd = 'ls'; var value = ['-z', '/usr']; var opt = { }; var child = child_process.spawn(cmd, value, opt); child.stdout.on('data', function (data) { console.log("IM HERE"); console.log('data' + data); }); child.stderr.on('data', function (data) { console.log("IM HERE - Error"); console.log('test: ' + data); process.exit(1); }); child.on('close', function (code) { console.log("IM HERE"); console.log("close"); });
Loading…

no comments

    sign in to comment