Logs now render in a full-screen view above a bottom prompt line when both
stdin and stdout are a terminal; typing live-filters the scrollback to lines
containing every typed word, case-insensitively. --plain restores the
previous streaming output, and piped usage is unaffected either way.
Also finishes the Python 3 port that #177 and #173 started:
- print(linebuf.encode('utf-8')) printed the bytes repr of every line instead
of the line itself
- named_processes was still a lazily-exhausted map() object after #177
wrapped catchall_package in list()
- piping adb logcat into pidcat crashed, since FakeStdinProcess read
sys.stdin (str) where the rest of the script expected bytes
- indent_wrap could hang given a non-positive wrap area
- the shebang invoked python, which does not exist on systems that only ship
python3
if use ps_pid.poll() to check for termination condition, there is a
race condition. consider this, the check for ps_pid.poll() succeed
and continue to process the output. when the output is being
processed, the "ps_pid" process terminated, generating some more
output, which hasn't yet been read by pidcat process. after pidcat
continues next loop iteration, the ps_pid.poll() check terminate the
loop, and the remaining output is lost. if the target process's pid
is in the lost output, then the target pid can't be retrieved.
Some phones (like my samsung) do not log the 'Start proc ...' line in
logcat to indicate process start. In my case it does log a line like
E/dalvikvm(pid): >>>>>> com.my.package [ more stuff ]
This commit adds support for that format to pidcat.
This specifically handles the case where you get a log snippet that may
not have any pid creation lines in it and pidcat ends up filtering
everything out. In this case we just print the line if we haven't seen
any pids yet.
An alternative would be allowing filter by pid, however I find grep
works fine for that.
Summary: The regexes for process exits were no matching secondary processes, which makes it understandably hard to track their
lifecycles. Fix it by including ':' in the process name match groups, as in the process start regex.
Test Plan: Run, match the chrome process name, com.android.chrome, see its secondary processes start reporting their death.
Summary: Android apps can use multiple processes (eg, chrome), which are identified as <package_name>:<process_name> in logs. The names are defined in the manifest.
The main process is referred to as simply <package_name> by android.
Add the ability to specify a target process as part of what was until now the package name in pidcat, or all processes if no process is specified.
Usage:
* pidcat <package_name> will match all of an app's processes (catchall).
* pidcat <package_name>:<process_name> will match a given named process.
** In particular, pidcat <package_name>: will ensure only the app's main/default process is matched.
Test Plan: Run the script, try out with no process, empty (aka default) process, named process. Try multiple entries.
Summary: Making sense of a birth/death message is made easier by specifying which process it applies to, and not just the component or the pid.
Test Plan: Run, monitor message lines when cycling a multi-process app, inject None as a process name to check resilience.