mirror of
https://github.com/openstf/stf
synced 2025-10-05 10:39:25 +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:
parent
083a2a1f92
commit
86ed8cd1f0
1 changed files with 6 additions and 2 deletions
|
@ -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(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue