1
0
Fork 0
mirror of https://github.com/YunoHost/yunohost.git synced 2024-09-03 20:06:10 +02:00

Properly handle case where no match from grep

This commit is contained in:
Alexandre Aubin 2020-09-08 17:20:59 +02:00
parent 8b98360fd2
commit 50f68e2886

View file

@ -119,8 +119,8 @@ class SystemResourcesDiagnoser(Diagnoser):
def analyzed_kern_log(): def analyzed_kern_log():
cmd = 'tail -n 10000 /var/log/kern.log | grep "oom_reaper: reaped process" || true' cmd = 'tail -n 10000 /var/log/kern.log | grep "oom_reaper: reaped process" || true'
out = subprocess.check_output(cmd, shell=True) out = subprocess.check_output(cmd, shell=True).strip()
lines = out.strip().split("\n") lines = out.split("\n") if out else []
now = datetime.datetime.now() now = datetime.datetime.now()