From 69e434d08ca64bc4ac8aaded584bfd17f1ff87a9 Mon Sep 17 00:00:00 2001 From: song Date: Fri, 6 Apr 2018 15:19:18 +0800 Subject: [PATCH] change 'ps -lef' to 'ps -le 2>/dev/null' to filter weird errors in output --- lib/util/devutil.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/util/devutil.js b/lib/util/devutil.js index de51022e..6eb128d9 100644 --- a/lib/util/devutil.js +++ b/lib/util/devutil.js @@ -50,7 +50,7 @@ devutil.listPidsByComm = function(adb, serial, comm, bin) { } else { 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])) } } @@ -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(function(pids) { if (pids.length > 0) { // return pids if process can be found in the output of 'ps' command return Promise.resolve(pids) } else { // otherwise try to run 'ps -elf' - return adb.shell(serial, 'ps -lef') + return adb.shell(serial, 'ps -lef 2>/dev/null') .then(findProcess) } })