mirror of
https://github.com/imcarlost/pidcat-repl.git
synced 2026-08-08 23:17:43 -04:00
@@ -113,7 +113,7 @@ PID_DEATH = re.compile(r'^\rProcess ([a-zA-Z0-9._]+) \(pid (\d+)\) has died.?$')
|
|||||||
LOG_LINE = re.compile(r'^([A-Z])/([^\(]+)\( *(\d+)\): (.*)\r?$')
|
LOG_LINE = re.compile(r'^([A-Z])/([^\(]+)\( *(\d+)\): (.*)\r?$')
|
||||||
|
|
||||||
input = os.popen('adb logcat')
|
input = os.popen('adb logcat')
|
||||||
pid = None
|
pids = set()
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
@@ -132,7 +132,7 @@ while True:
|
|||||||
line_package, target, line_pid, line_uid, line_gids = start.groups()
|
line_package, target, line_pid, line_uid, line_gids = start.groups()
|
||||||
|
|
||||||
if line_package == package:
|
if line_package == package:
|
||||||
pid = line_pid
|
pids.add(line_pid)
|
||||||
|
|
||||||
linebuf = '\n\n\n'
|
linebuf = '\n\n\n'
|
||||||
linebuf += colorize(' ' * (header_size - 1), bg=WHITE)
|
linebuf += colorize(' ' * (header_size - 1), bg=WHITE)
|
||||||
@@ -145,9 +145,7 @@ while True:
|
|||||||
kill = PID_KILL.match(message)
|
kill = PID_KILL.match(message)
|
||||||
if kill is not None:
|
if kill is not None:
|
||||||
line_pid, line_package, reason = kill.groups()
|
line_pid, line_package, reason = kill.groups()
|
||||||
if 'ActivityManager' == tag and pid == line_pid and package == line_package:
|
if 'ActivityManager' == tag and line_pid in pids and package == line_package:
|
||||||
pid = None
|
|
||||||
|
|
||||||
linebuf = '\n'
|
linebuf = '\n'
|
||||||
linebuf += colorize(' ' * (header_size - 1), bg=RED)
|
linebuf += colorize(' ' * (header_size - 1), bg=RED)
|
||||||
linebuf += ' Process killed because %s' % reason
|
linebuf += ' Process killed because %s' % reason
|
||||||
@@ -157,15 +155,13 @@ while True:
|
|||||||
death = PID_DEATH.match(message)
|
death = PID_DEATH.match(message)
|
||||||
if death is not None:
|
if death is not None:
|
||||||
line_package, line_pid = death.groups()
|
line_package, line_pid = death.groups()
|
||||||
if 'ActivityManager' == tag and pid == line_pid and package == line_package:
|
if 'ActivityManager' == tag and line_pid in pids and package == line_package:
|
||||||
pid = None
|
|
||||||
|
|
||||||
linebuf = '\n'
|
linebuf = '\n'
|
||||||
linebuf += colorize(' ' * (header_size - 1), bg=RED)
|
linebuf += colorize(' ' * (header_size - 1), bg=RED)
|
||||||
linebuf += ' Process killed because no longer wanted\n\n\n'
|
linebuf += ' Process killed because no longer wanted\n\n\n'
|
||||||
print linebuf
|
print linebuf
|
||||||
|
|
||||||
if pid is None or owner != pid:
|
if owner not in pids:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
linebuf = ''
|
linebuf = ''
|
||||||
|
|||||||
Reference in New Issue
Block a user