Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var sys = require('sys'),
- spawn = require('child_process').spawn,
- ls = spawn('ls', ['-lh', '/usr']);
- ls.stdout.addListener('data', function (data) {
- sys.print('stdout: ' + data);
- });
- ls.stderr.addListener('data', function (data) {
- sys.print('stderr: ' + data);
- });
- ls.addListener('exit', function (code) {
- sys.puts('child process exited with code ' + code);
- });
- //Question: Why doesn't the ls child process terminate before event listener for "exit" has been added?
Add Comment
Please, Sign In to add comment