summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYanichkin Alexander <Alexander_Sergey@mail.ru>2021-10-08 09:25:31 +0800
committerPaul Wise <pabs3@bonedaddy.net>2021-10-08 09:32:28 +0800
commit443737ec620a699286b9b2e44dbcaac53f553812 (patch)
tree7563dedff725b5b1913604e7f04f14a23f2ffbb4
parentab35334d374e588bec12d201fb8869c536f0545d (diff)
downloadiotop-443737ec620a699286b9b2e44dbcaac53f553812.tar.gz
Workaround crashes due to non-UTF-8 characters in process command-lines
Use the Python feature of replacing non-UTF-8 characters with the U+FFFD REPLACEMENT CHARACTER (�). This is only a workaround, a more useful action would be to guess the encoding using chardet or similar and coerce the bytes into Unicode. Fixes: https://bugs.launchpad.net/ubuntu/+source/iotop/+bug/1932523 Fixes: https://bugs.debian.org/737043
-rw-r--r--iotop/data.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/iotop/data.py b/iotop/data.py
index 5d70e29..f5496d0 100644
--- a/iotop/data.py
+++ b/iotop/data.py
@@ -207,7 +207,7 @@ def find_uids(options):
def parse_proc_pid_status(pid):
result_dict = {}
try:
- for line in open('/proc/%d/status' % pid):
+ for line in open('/proc/%d/status' % pid, errors='replace'):
try:
key, value = line.split(':', 1)
except ValueError: