fix Bug with GUI notifications #86
This commit is contained in:
parent
cda2c95a00
commit
122233ac2f
@ -176,13 +176,11 @@ def re_pid_environ(pid):
|
|||||||
returns None if these vars is not in /proc/[pid]/environ
|
returns None if these vars is not in /proc/[pid]/environ
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open('/proc/' + pid + '/environ') as f:
|
with open('/proc/' + pid + '/environ', 'rb') as f:
|
||||||
env = f.read()
|
env = f.read().decode('utf-8', 'ignore')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
log('notify helper: FileNotFoundError')
|
|
||||||
return None
|
return None
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
log('notify helper: ProcessLookupError')
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
if display_env in env and dbus_env in env and user_env in env:
|
if display_env in env and dbus_env in env and user_env in env:
|
||||||
@ -929,10 +927,13 @@ def pid_to_cmdline(pid):
|
|||||||
returns string cmdline
|
returns string cmdline
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open('/proc/' + pid + '/cmdline') as f:
|
with open('/proc/' + pid + '/cmdline', 'rb') as f:
|
||||||
return f.read().replace('\x00', ' ').rstrip()
|
return f.read().decode('utf-8', 'ignore').replace(
|
||||||
|
'\x00', ' ').rstrip()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return ''
|
return ''
|
||||||
|
except ProcessLookupError:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def pid_to_environ(pid):
|
def pid_to_environ(pid):
|
||||||
@ -943,10 +944,13 @@ def pid_to_environ(pid):
|
|||||||
returns string environ
|
returns string environ
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
with open('/proc/' + pid + '/environ') as f:
|
with open('/proc/' + pid + '/environ', 'rb') as f:
|
||||||
return f.read().replace('\x00', ' ').rstrip()
|
return f.read().decode('utf-8', 'ignore').replace(
|
||||||
|
'\x00', ' ').rstrip()
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return ''
|
return ''
|
||||||
|
except ProcessLookupError:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def pid_to_realpath(pid):
|
def pid_to_realpath(pid):
|
||||||
@ -956,6 +960,8 @@ def pid_to_realpath(pid):
|
|||||||
return os.path.realpath('/proc/' + pid + '/exe')
|
return os.path.realpath('/proc/' + pid + '/exe')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return ''
|
return ''
|
||||||
|
except ProcessLookupError:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def pid_to_cwd(pid):
|
def pid_to_cwd(pid):
|
||||||
@ -965,6 +971,8 @@ def pid_to_cwd(pid):
|
|||||||
return os.path.realpath('/proc/' + pid + '/cwd')
|
return os.path.realpath('/proc/' + pid + '/cwd')
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
return ''
|
return ''
|
||||||
|
except ProcessLookupError:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
def pid_to_uid(pid):
|
def pid_to_uid(pid):
|
||||||
|
Loading…
Reference in New Issue
Block a user