mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Remove duplicate code.
This commit is contained in:
parent
685882d19f
commit
7202f102d9
1 changed files with 7 additions and 14 deletions
|
@ -289,7 +289,7 @@ module.exports = syrup.serial()
|
|||
})
|
||||
}
|
||||
|
||||
function kindKill() {
|
||||
function kill(signal) {
|
||||
if (pid <= 0) {
|
||||
return Promise.reject(new Error('Minicap service pid is unknown'))
|
||||
}
|
||||
|
@ -297,26 +297,19 @@ module.exports = syrup.serial()
|
|||
log.info('Sending SIGTERM to minicap')
|
||||
return Promise.all([
|
||||
waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', pid])
|
||||
, adb.shell(options.serial, ['kill', signal, pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.timeout(2000)
|
||||
.return(true)
|
||||
])
|
||||
}
|
||||
|
||||
function forceKill() {
|
||||
if (pid <= 0) {
|
||||
return Promise.reject(new Error('Minicap service pid is unknown'))
|
||||
}
|
||||
function kindKill() {
|
||||
return kill('-15')
|
||||
}
|
||||
|
||||
log.info('Sending SIGKILL to minicap')
|
||||
return Promise.all([
|
||||
waitForEnd()
|
||||
, adb.shell(options.serial, ['kill', '-9', pid])
|
||||
.then(adbkit.util.readAll)
|
||||
.timeout(2000)
|
||||
.return(true)
|
||||
])
|
||||
function forceKill() {
|
||||
return kill('-9')
|
||||
}
|
||||
|
||||
function forceEnd() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue