mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-19 00:23:25 +02:00
Add timeouts everywhere. Should help if the ADB socket gets stuck like it sometimes does.
This commit is contained in:
@@ -36,6 +36,7 @@ module.exports = syrup.serial()
|
||||
|
||||
function removeResource(res) {
|
||||
return adb.shell(options.serial, ['rm', res.dest])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
return streamutil.readAll(out)
|
||||
})
|
||||
@@ -44,6 +45,7 @@ module.exports = syrup.serial()
|
||||
|
||||
function installResource(res) {
|
||||
return adb.push(options.serial, res.src, res.dest, res.mode)
|
||||
.timeout(10000)
|
||||
.then(function(transfer) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
transfer.on('error', reject)
|
||||
@@ -55,9 +57,11 @@ module.exports = syrup.serial()
|
||||
|
||||
function ensureNotBusy(res) {
|
||||
return adb.shell(options.serial, [res.dest, '--help'])
|
||||
.timeout(10000)
|
||||
.then(function(out) {
|
||||
// Can be "Text is busy", "text busy"
|
||||
return streamutil.findLine(out, (/busy/i))
|
||||
.timeout(10000)
|
||||
.then(function() {
|
||||
log.info('Binary is busy, will retry')
|
||||
return Promise.delay(1000)
|
||||
@@ -80,11 +84,12 @@ module.exports = syrup.serial()
|
||||
|
||||
function stop() {
|
||||
return devutil.killProcsByComm(
|
||||
adb
|
||||
, options.serial
|
||||
, resources.bin.comm
|
||||
, resources.bin.dest
|
||||
)
|
||||
adb
|
||||
, options.serial
|
||||
, resources.bin.comm
|
||||
, resources.bin.dest
|
||||
)
|
||||
.timeout(15000)
|
||||
}
|
||||
|
||||
return stop()
|
||||
|
||||
Reference in New Issue
Block a user