1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-06 03:50:04 +02:00

Don't try to restart if we're stopping.

This commit is contained in:
Simo Kinnunen 2014-04-11 10:24:39 +09:00
parent e10a58c881
commit e4b701df5d

View file

@ -104,6 +104,7 @@ module.exports = function(options) {
log.info('Found device "%s" (%s)', device.id, device.type) log.info('Found device "%s" (%s)', device.id, device.type)
var privateTracker = new events.EventEmitter() var privateTracker = new events.EventEmitter()
, willStop = false
, timer , timer
, worker , worker
@ -209,9 +210,11 @@ module.exports = function(options) {
switch (device.type) { switch (device.type) {
case 'device': case 'device':
case 'emulator': case 'emulator':
willStop = false
timer = setTimeout(work, 100) timer = setTimeout(work, 100)
break break
default: default:
willStop = true
timer = setTimeout(stop, 100) timer = setTimeout(stop, 100)
break break
} }
@ -230,6 +233,7 @@ module.exports = function(options) {
worker = null worker = null
}) })
.catch(procutil.ExitError, function(err) { .catch(procutil.ExitError, function(err) {
if (!willStop) {
log.error( log.error(
'Device worker "%s" died with code %s' 'Device worker "%s" died with code %s'
, device.id , device.id
@ -240,6 +244,7 @@ module.exports = function(options) {
.then(function() { .then(function() {
return work() return work()
}) })
}
}) })
} }