I'm running on Bash 5.1.16 and have the TERM variables set appropriately:
$ env | grep TERM
COLORTERM=truecolor
TERM=xterm-256color
If I run pidcat with python3, I get output like this:
b'\x1b[37m ActivityManager\x1b[0m \x1b[30;102m I \x1b[0m Process com.samsung.android.app.galaxyfinder:appservice (pid 18912) has died: fg SVC (127,1420)'
b'\x1b[33matibilityChangeReporter\x1b[0m \x1b[30;104m D \x1b[0m Compat change id reported: 135634846; UID 10300; state: DISABLED'
b' \x1b[30;104m D \x1b[0m Compat change id reported: 143937733; UID 10300; state: ENABLED'
but if I run with python2, then I get colorized output as expected.
If I delete the .encode(utf-8) from the final print statement, then it works as expected on both Python2 and Python3, but I suspect this might cause problems on some systems if locale isn't utf-8.
$ git revert -n 6b6034ab67
Auto-merging pidcat.py
$ git reset
Unstaged changes after reset:
M pidcat.py
$ git diff
diff --git a/pidcat.py b/pidcat.py
index 6a23786..4a2b42f 100755
--- a/pidcat.py
+++ b/pidcat.py
@@ -359,4 +359,4 @@ while adb.poll() is None:
message = matcher.sub(replace, message)
linebuf += indent_wrap(message)
- print(linebuf.encode('utf-8'))
+ print(linebuf)
I'm running on Bash 5.1.16 and have the
TERM
variables set appropriately:If I run pidcat with python3, I get output like this:
but if I run with python2, then I get colorized output as expected.
If I delete the
.encode(utf-8)
from the final print statement, then it works as expected on both Python2 and Python3, but I suspect this might cause problems on some systems if locale isn'tutf-8
.