mirror of
https://github.com/ARM-software/devlib.git
synced 2025-03-04 09:17:51 +00:00
uitils/android: Fix logcat monitor on older devices
The `-e` argument to match logcat output with a regex expression is not present on older devices. If the target is running pre marshmallow fall back to pipeing logcat into grep.
This commit is contained in:
parent
a992a890b8
commit
c585a4e489
@ -586,7 +586,12 @@ class LogcatMonitor(object):
|
|||||||
regexp = '{}'.format('|'.join(self._regexps))
|
regexp = '{}'.format('|'.join(self._regexps))
|
||||||
if len(self._regexps) > 1:
|
if len(self._regexps) > 1:
|
||||||
regexp = '({})'.format(regexp)
|
regexp = '({})'.format(regexp)
|
||||||
|
# Logcat on older version of android do not support the -e argument
|
||||||
|
# so fall back to using grep.
|
||||||
|
if self.target.get_sdk_version() > 23:
|
||||||
logcat_cmd = '{} -e "{}"'.format(logcat_cmd, regexp)
|
logcat_cmd = '{} -e "{}"'.format(logcat_cmd, regexp)
|
||||||
|
else:
|
||||||
|
logcat_cmd = '{} | grep "{}"'.format(logcat_cmd, regexp)
|
||||||
|
|
||||||
logcat_cmd = get_adb_command(self.target.conn.device, logcat_cmd)
|
logcat_cmd = get_adb_command(self.target.conn.device, logcat_cmd)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user