[proc-exit-listener]: ignore blank lines

make proc-exit-listener more rebust

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
Guohan Lu 2021-01-27 09:34:03 -08:00 committed by lguohan
parent aab37b7f42
commit 34cca20cb6

View File

@ -2,6 +2,7 @@
import getopt import getopt
import os import os
import re
import select import select
import signal import signal
import sys import sys
@ -40,6 +41,9 @@ def get_critical_group_and_process_list():
with open(CRITICAL_PROCESSES_FILE, 'r') as file: with open(CRITICAL_PROCESSES_FILE, 'r') as file:
for line in file: for line in file:
# ignore blank lines
if re.match(r"^\s*$", line)
continue
line_info = line.strip(' \n').split(':') line_info = line.strip(' \n').split(':')
if len(line_info) != 2: if len(line_info) != 2:
syslog.syslog(syslog.LOG_ERR, syslog.syslog(syslog.LOG_ERR,