Child process issue


var child = require(‘child_process’).spawn(“subl”);

child.on('exit', function (code) {
  console.log('++++child process exited with code ' + code);

And I noticed that subl (sublime text) is launched, but the “exit” callback is immediately fired with code 0 (sublime is still there !)

If I test with grep, ls it works…


This isn’t an Atom issue and also I don’t see what the problem is. Doesn’t it do the same thing from a command line?


The “problem” seems obvious:
The exit callback is fired whilst the child process remains “alive”.

And yes, the behaviour is the same under pure node.js.

Of course you’re right, perhaps I should send this message into node forum…


Isn’t subl the command-line launching utility? I thought it launches Sublime and exits? So wouldn’t this be the expected behavior? The launcher exits but Sublime (the GUI) stays running.