1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 10:19:30 +02:00

Move more work to devutil.

This commit is contained in:
Simo Kinnunen 2014-01-29 14:13:52 +09:00
parent 3c55f91ee9
commit 6c350d0068
2 changed files with 31 additions and 27 deletions

View file

@ -26,6 +26,20 @@ devutil.vendorFiles = function(identity) {
}
}
devutil.ensureUnusedPort = function(adb, serial, port) {
function closedError(err) {
return err.message === 'closed'
}
return adb.openTcpAsync(serial, port)
.then(function(conn) {
conn.end()
throw new Error(util.format('Port "%d" should be unused', port))
})
.catch(closedError, function(err) {
return Promise.resolve(port)
})
}
devutil.killProcsByComm = function(adb, serial, comm, bin) {
return adb.shellAsync(serial, ['ps', comm])
.then(function(out) {