Merge pull request #722 from wibblymat/reject-on-spawn-error

Reject the promise for a command if an error event is fired
This commit is contained in:
André Cruz
2013-08-05 14:53:44 -07:00

View File

@@ -68,6 +68,11 @@ function cmd(command, args, options) {
stderr += data;
});
// If there is an error spawning the command, reject the promise
process.on('error', function (error) {
return deferred.reject(error)
});
// Listen to the close event instead of exit
// They are similar but close ensures that streams are flushed
process.on('close', function (code) {