mirror of
https://github.com/openstf/stf
synced 2025-10-06 12:00:08 +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) {
|
if (pid <= 0) {
|
||||||
return Promise.reject(new Error('Minicap service pid is unknown'))
|
return Promise.reject(new Error('Minicap service pid is unknown'))
|
||||||
}
|
}
|
||||||
|
@ -297,26 +297,19 @@ module.exports = syrup.serial()
|
||||||
log.info('Sending SIGTERM to minicap')
|
log.info('Sending SIGTERM to minicap')
|
||||||
return Promise.all([
|
return Promise.all([
|
||||||
waitForEnd()
|
waitForEnd()
|
||||||
, adb.shell(options.serial, ['kill', pid])
|
, adb.shell(options.serial, ['kill', signal, pid])
|
||||||
.then(adbkit.util.readAll)
|
.then(adbkit.util.readAll)
|
||||||
.timeout(2000)
|
.timeout(2000)
|
||||||
.return(true)
|
.return(true)
|
||||||
])
|
])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function kindKill() {
|
||||||
|
return kill('-15')
|
||||||
|
}
|
||||||
|
|
||||||
function forceKill() {
|
function forceKill() {
|
||||||
if (pid <= 0) {
|
return kill('-9')
|
||||||
return Promise.reject(new Error('Minicap service pid is unknown'))
|
|
||||||
}
|
|
||||||
|
|
||||||
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 forceEnd() {
|
function forceEnd() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue