Revert all adbkit upgrades (#207)

This commit is contained in:
Karol Wrótniak
2021-03-10 19:22:32 +01:00
committed by GitHub
parent 84bf212497
commit 53acc928f5
25 changed files with 60 additions and 105 deletions

View File

@@ -3,7 +3,6 @@ var util = require('util')
var split = require('split')
var Promise = require('bluebird')
var androidDeviceList = require('android-device-list')
var DeviceClient = require('@devicefarmer/adbkit/dist/src/adb/DeviceClient').default
var devutil = module.exports = Object.create(null)
@@ -12,8 +11,7 @@ function closedError(err) {
}
devutil.ensureUnusedLocalSocket = function(adb, serial, sock) {
var deviceClient = new DeviceClient(adb, serial)
return deviceClient.openLocal(sock)
return adb.openLocal(serial, sock)
.then(function(conn) {
conn.end()
throw new Error(util.format('Local socket "%s" should be unused', sock))
@@ -24,8 +22,7 @@ devutil.ensureUnusedLocalSocket = function(adb, serial, sock) {
}
devutil.waitForLocalSocket = function(adb, serial, sock) {
var deviceClient = new DeviceClient(adb, serial)
return deviceClient.openLocal(sock)
return adb.openLocal(serial, sock)
.then(function(conn) {
conn.sock = sock
return conn
@@ -39,7 +36,6 @@ devutil.waitForLocalSocket = function(adb, serial, sock) {
}
devutil.listPidsByComm = function(adb, serial, comm, bin) {
var deviceClient = new DeviceClient(adb, serial)
var users = {
shell: true
}
@@ -75,7 +71,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
})
}
return deviceClient.shell('ps 2>/dev/null')
return adb.shell(serial, 'ps 2>/dev/null')
.then(findProcess)
.then(function(res) {
// return pids if process can be found in the output of 'ps' command
@@ -85,7 +81,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
}
// otherwise try to run 'ps -elf'
else {
return deviceClient.shell('ps -lef 2>/dev/null')
return adb.shell(serial, 'ps -lef 2>/dev/null')
.then(findProcess)
.then(function(res) {
return Promise.resolve(res.pids)
@@ -107,13 +103,12 @@ devutil.waitForProcsToDie = function(adb, serial, comm, bin) {
}
devutil.killProcsByComm = function(adb, serial, comm, bin, mode) {
var deviceClient = new DeviceClient(adb, serial)
return devutil.listPidsByComm(adb, serial, comm, bin, mode)
.then(function(pids) {
if (!pids.length) {
return Promise.resolve()
}
return deviceClient.shell(['kill', mode || -15].concat(pids))
return adb.shell(serial, ['kill', mode || -15].concat(pids))
.then(function(out) {
return new Promise(function(resolve) {
out.on('end', resolve)