mirror of
https://github.com/openstf/stf
synced 2025-10-04 18:29:17 +02:00
Hopefully get rid of FrameProducer._stop() timeouts. Doesn't reproduce locally.
This commit is contained in:
parent
cfc84a0e42
commit
dc07777829
3 changed files with 52 additions and 42 deletions
|
@ -325,39 +325,32 @@ module.exports = syrup.serial()
|
|||
|
||||
var pid = this.banner ? this.banner.pid : -1
|
||||
|
||||
function waitForEnd() {
|
||||
var endListener
|
||||
return new Promise(function(resolve/*, reject*/) {
|
||||
output.expectEnd().on('end', endListener = function() {
|
||||
resolve(true)
|
||||
})
|
||||
})
|
||||
.finally(function() {
|
||||
output.removeListener('end', endListener)
|
||||
})
|
||||
}
|
||||
|
||||
function kill(signal) {
|
||||
if (pid <= 0) {
|
||||
return Promise.reject(new Error('Minicap service pid is unknown'))
|
||||
}
|
||||
|
||||
log.info('Sending SIGTERM to minicap')
|
||||
var signum = {
|
||||
'SIGTERM': -15
|
||||
, 'SIGKILL': -9
|
||||
}[signal]
|
||||
|
||||
log.info('Sending %s to minicap', signal)
|
||||
return Promise.all([
|
||||
waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', signal, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.timeout(2000)
|
||||
.return(true)
|
||||
])
|
||||
output.waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', signum, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.return(true)
|
||||
])
|
||||
.timeout(2000)
|
||||
}
|
||||
|
||||
function kindKill() {
|
||||
return kill('-15')
|
||||
return kill('SIGTERM')
|
||||
}
|
||||
|
||||
function forceKill() {
|
||||
return kill('-9')
|
||||
return kill('SIGKILL')
|
||||
}
|
||||
|
||||
function forceEnd() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue