arc.py: Set ignore_status for adb commands where failures are valid
After adb uprev in crrev.com/c/1556640, `adb shell` starts returning
exit status of the actual command rather that always returning zero.
Adding ignore_status=True for utility functions where command failures
are valid in some use cases.
BUG=b:130585881
TEST=cheets_ApkIntegrityTest.*
Change-Id: Ic6bfd7e3772dd9ba86fe57bdf1b389eeb0b71bd8
Reviewed-on: https://chromium-review.googlesource.com/1573307
Commit-Ready: Shao-Chuan Lee <shaochuan@chromium.org>
Tested-by: Shao-Chuan Lee <shaochuan@chromium.org>
Reviewed-by: Junichi Uekawa <uekawa@chromium.org>
diff --git a/client/common_lib/cros/arc.py b/client/common_lib/cros/arc.py
index cc55bbe..47778a3 100644
--- a/client/common_lib/cros/arc.py
+++ b/client/common_lib/cros/arc.py
@@ -363,7 +363,8 @@
@param process_name: Process name.
"""
- output = adb_shell('pgrep -c -f %s' % pipes.quote(process_name))
+ output = adb_shell('pgrep -c -f %s' % pipes.quote(process_name),
+ ignore_status=True)
return int(output) > 0
@@ -372,8 +373,9 @@
@param filename: File to check.
"""
- return adb_shell('test -e {} && echo FileExists'.format(
- pipes.quote(filename))).find("FileExists") >= 0
+ return adb_shell(
+ 'test -e {} && echo FileExists'.format(pipes.quote(filename)),
+ ignore_status=True).find("FileExists") >= 0
def read_android_file(filename):