mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-27 00:05:15 +02:00
Use 'ps -lef' instead of 'ps' to list Pids on Android 8.x
This commit is contained in:
@@ -5,6 +5,8 @@ var Promise = require('bluebird')
|
|||||||
|
|
||||||
var devutil = module.exports = Object.create(null)
|
var devutil = module.exports = Object.create(null)
|
||||||
|
|
||||||
|
var commands = Object.create(null)
|
||||||
|
|
||||||
function closedError(err) {
|
function closedError(err) {
|
||||||
return err.message.indexOf('closed') !== -1
|
return err.message.indexOf('closed') !== -1
|
||||||
}
|
}
|
||||||
@@ -39,7 +41,24 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
|||||||
shell: true
|
shell: true
|
||||||
}
|
}
|
||||||
|
|
||||||
return adb.shell(serial, ['ps'])
|
return new Promise(function(resolve) {
|
||||||
|
if ('ps' in commands) {
|
||||||
|
resolve(commands)
|
||||||
|
} else {
|
||||||
|
adb.getProperties(serial)
|
||||||
|
.then(function (properties) {
|
||||||
|
version = properties['ro.build.version.release']
|
||||||
|
if (version.match(/^8\./) != null) {
|
||||||
|
commands['ps'] = 'ps -lef'
|
||||||
|
} else {
|
||||||
|
commands['ps'] = 'ps'
|
||||||
|
}
|
||||||
|
resolve(commands)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(function (commands) {
|
||||||
|
return adb.shell(serial, [commands['ps']])
|
||||||
.then(function (out) {
|
.then(function (out) {
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
var header = true
|
var header = true
|
||||||
@@ -61,6 +80,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
devutil.waitForProcsToDie = function(adb, serial, comm, bin) {
|
devutil.waitForProcsToDie = function(adb, serial, comm, bin) {
|
||||||
|
|||||||
Reference in New Issue
Block a user