Why is my Node child process that I created via spawn() hanging?

Viewed 6826

I am using spawn() to make a git call. Sometimes it works fine but others it appears to be hanging. I see no events firing (error, exit, close) yet I see evidence that the process did in fact complete successfully.

var spawn = require('child_process').spawn;

spawn('git', ['push', 'origin', 'master'])
  .on('error', function(error) {
    console.log("ERROR: DETAILS: " + error);
  })
  .on('close', function(code) {
    console.log("SUCCESS: CODE: " + code);
  })
  .on('exit', function(code) {
    console.log("EXIT: CODE: " + code);
  })
1 Answers
Related