mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:03:30 +02:00
Remove duplicate code.
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user