mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 02:53:19 +02:00
Prevent attempt to gracefull kill device worker during cleanup if it has already exited. Not very elegant but it does its job. This should get rid of most Ctrl+C delays.
This commit is contained in:
@@ -181,8 +181,10 @@ module.exports = function(options) {
|
||||
var allocatedPorts = ports.splice(0, 4)
|
||||
var proc = options.fork(device, allocatedPorts.slice())
|
||||
var resolver = Promise.defer()
|
||||
var didExit = false
|
||||
|
||||
function exitListener(code, signal) {
|
||||
didExit = true
|
||||
if (signal) {
|
||||
log.warn(
|
||||
'Device worker "%s" was killed with signal %s, assuming ' +
|
||||
@@ -248,8 +250,10 @@ module.exports = function(options) {
|
||||
_.pull(lists.waiting, device.id)
|
||||
})
|
||||
.catch(Promise.CancellationError, function() {
|
||||
log.info('Gracefully killing device worker "%s"', device.id)
|
||||
return procutil.gracefullyKill(proc, options.killTimeout)
|
||||
if (!didExit) {
|
||||
log.info('Gracefully killing device worker "%s"', device.id)
|
||||
return procutil.gracefullyKill(proc, options.killTimeout)
|
||||
}
|
||||
})
|
||||
.catch(Promise.TimeoutError, function(err) {
|
||||
log.error(
|
||||
|
||||
Reference in New Issue
Block a user