diff options
Diffstat (limited to 'lib/utils/command.js')
-rw-r--r-- | lib/utils/command.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/utils/command.js b/lib/utils/command.js index 49b0998..c1689cb 100644 --- a/lib/utils/command.js +++ b/lib/utils/command.js @@ -11,7 +11,26 @@ function exec(command, options) { return Promise.reject(new Error('Command execution is not possible on this platform')); } - return Promise.nfcall(childProcess.exec, command, options); + var d = Promise.defer(); + + var child = childProcess.exec(command, options, function(err, stdout, stderr) { + if (!err) { + d.resolve(); + } + + err.message = stdout.toString('utf8') + stderr.toString('utf8'); + d.reject(err); + }); + + child.stdout.on('data', function (data) { + d.notify(data); + }); + + child.stderr.on('data', function (data) { + d.notify(data); + }); + + return d.promise; } // Spawn an executable |