resolve on 'exit' not 'close'

This commit is contained in:
Daniel Sommer 2022-03-21 23:16:32 +01:00
parent 5c8a141e68
commit a32544fbff

View file

@ -12,13 +12,13 @@ function execute(cmd, args) {
spawned.stderr.on('data', function (data) { spawned.stderr.on('data', function (data) {
logger.error(data); logger.error(data);
}); });
spawned.on('close', function (code) { spawned.on('error', function (err) {
reject('command \'' + cmd + '\' with args \'' + args + '\' encountered an error after ' + util.timeDiff(spawned.timestamp) + 'ms >>> ' + err);
});
spawned.on('exit', function (code) {
logger.debug('command \'' + cmd + '\' with args \'' + args + '\' finished with exit code ' + code + ' after ' + util.timeDiff(spawned.timestamp) + 'ms'); logger.debug('command \'' + cmd + '\' with args \'' + args + '\' finished with exit code ' + code + ' after ' + util.timeDiff(spawned.timestamp) + 'ms');
resolve(); resolve();
}); });
spawned.on('error', function (err) {
return reject('command \'' + cmd + '\' with args \'' + args + '\' encountered an error after ' + util.timeDiff(spawned.timestamp) + 'ms >>> ' + err);
});
}); });
} }