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

change 'ps -lef' to 'ps -le 2>/dev/null' to filter weird errors in output

This commit is contained in:
song 2018-04-06 15:19:18 +08:00
parent 1d7efd0694
commit 69e434d08c

View file

@ -50,7 +50,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
} }
else { else {
var cols = chunk.toString().split(/\s+/) var cols = chunk.toString().split(/\s+/)
if (cols.pop() === bin && users[cols[0]]) { if (cols.pop() === comm && users[cols[0]]) {
pids.push(Number(cols[1])) pids.push(Number(cols[1]))
} }
} }
@ -61,14 +61,14 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) {
}) })
} }
return adb.shell(serial, 'ps') return adb.shell(serial, 'ps 2>/dev/null')
.then(findProcess) .then(findProcess)
.then(function(pids) { .then(function(pids) {
if (pids.length > 0) { // return pids if process can be found in the output of 'ps' command if (pids.length > 0) { // return pids if process can be found in the output of 'ps' command
return Promise.resolve(pids) return Promise.resolve(pids)
} }
else { // otherwise try to run 'ps -elf' else { // otherwise try to run 'ps -elf'
return adb.shell(serial, 'ps -lef') return adb.shell(serial, 'ps -lef 2>/dev/null')
.then(findProcess) .then(findProcess)
} }
}) })