UTF-8 decode and trim each line.

Closes #18.
This commit is contained in:
Jake Wharton
2013-06-19 14:18:52 -07:00
parent 106a4ceacd
commit 571826e8c0
+9 -7
View File
@@ -127,11 +127,11 @@ TAGTYPES = {
'F': colorize(' F ', fg=BLACK, bg=RED),
}
PID_START = re.compile(r'^Start proc ([a-zA-Z0-9._:]+) for ([a-z]+ [^:]+): pid=(\d+) uid=(\d+) gids=(.*)\r?$')
PID_KILL = re.compile(r'^Killing (\d+):([a-zA-Z0-9._]+)/[^:]+: (.*)\r?$')
PID_LEAVE = re.compile(r'^No longer want ([a-zA-Z0-9._]+) \(pid (\d+)\): .*\r?$')
PID_DEATH = re.compile(r'^Process ([a-zA-Z0-9._]+) \(pid (\d+)\) has died.?\r$')
LOG_LINE = re.compile(r'^([A-Z])/([^\(]+)\( *(\d+)\): (.*?)\r?$')
PID_START = re.compile(r'^Start proc ([a-zA-Z0-9._:]+) for ([a-z]+ [^:]+): pid=(\d+) uid=(\d+) gids=(.*)$')
PID_KILL = re.compile(r'^Killing (\d+):([a-zA-Z0-9._]+)/[^:]+: (.*)$')
PID_LEAVE = re.compile(r'^No longer want ([a-zA-Z0-9._]+) \(pid (\d+)\): .*$')
PID_DEATH = re.compile(r'^Process ([a-zA-Z0-9._]+) \(pid (\d+)\) has died.?$')
LOG_LINE = re.compile(r'^([A-Z])/([^\(]+)\( *(\d+)\): (.*)$')
BUG_LINE = re.compile(r'^(?!.*(nativeGetEnabledTags)).*$')
adb_command = ['adb']
@@ -169,7 +169,7 @@ def parse_death(tag, message):
while adb.poll() is None:
try:
line = adb.stdout.readline()
line = adb.stdout.readline().decode('utf-8').strip()
except KeyboardInterrupt:
break
if len(line) == 0:
@@ -180,7 +180,9 @@ while adb.poll() is None:
continue
log_line = LOG_LINE.match(line)
if not log_line is None:
if log_line is None:
continue
level, tag, owner, message = log_line.groups()
start = PID_START.match(message)