fix GUI warns
This commit is contained in:
parent
3f4ecdb00a
commit
f34d8034c4
4
nohang
4
nohang
@ -180,7 +180,7 @@ def root_notify_env():
|
|||||||
new_env = []
|
new_env = []
|
||||||
end = []
|
end = []
|
||||||
for i in env:
|
for i in env:
|
||||||
print(i)
|
#print(i)
|
||||||
key = i[0] + i[1]
|
key = i[0] + i[1]
|
||||||
#print(key)
|
#print(key)
|
||||||
if key not in end:
|
if key not in end:
|
||||||
@ -188,7 +188,7 @@ def root_notify_env():
|
|||||||
new_env.append(i)
|
new_env.append(i)
|
||||||
else:
|
else:
|
||||||
continue
|
continue
|
||||||
print(new_env)
|
#print(new_env)
|
||||||
return new_env
|
return new_env
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,9 @@ def re_pid_environ(pid):
|
|||||||
'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus')
|
'DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus')
|
||||||
returns None if these vars is not in /proc/[pid]/environ
|
returns None if these vars is not in /proc/[pid]/environ
|
||||||
"""
|
"""
|
||||||
|
display_env = 'DISPLAY='
|
||||||
|
dbus_env = 'DBUS_SESSION_BUS_ADDRESS='
|
||||||
|
user_env = 'USER='
|
||||||
try:
|
try:
|
||||||
env = str(rline1('/proc/' + pid + '/environ'))
|
env = str(rline1('/proc/' + pid + '/environ'))
|
||||||
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:
|
||||||
@ -85,8 +88,8 @@ def re_pid_environ(pid):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if i.startswith(dbus_env):
|
if i.startswith(dbus_env):
|
||||||
if ',guid=' in i:
|
#if ',guid=' in i:
|
||||||
return None
|
# return None
|
||||||
dbus = i
|
dbus = i
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -99,23 +102,36 @@ def re_pid_environ(pid):
|
|||||||
return env
|
return env
|
||||||
|
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
pass
|
return None
|
||||||
except ProcessLookupError:
|
except ProcessLookupError:
|
||||||
pass
|
return None
|
||||||
|
|
||||||
|
|
||||||
def root_notify_env():
|
def root_notify_env():
|
||||||
"""return set(user, display, dbus)"""
|
"""return set(user, display, dbus)"""
|
||||||
unsorted_envs_list = []
|
unsorted_envs_list = []
|
||||||
# iterates over processes, find processes with suitable env
|
# iterates over processes, find processes with suitable env
|
||||||
for pid in listdir('/proc'):
|
for pid in os.listdir('/proc'):
|
||||||
if pid[0].isdecimal() is False:
|
if pid[0].isdecimal() is False:
|
||||||
continue
|
continue
|
||||||
one_env = re_pid_environ(pid)
|
one_env = re_pid_environ(pid)
|
||||||
unsorted_envs_list.append(one_env)
|
unsorted_envs_list.append(one_env)
|
||||||
env = set(unsorted_envs_list)
|
env = set(unsorted_envs_list)
|
||||||
env.discard(None)
|
env.discard(None)
|
||||||
return env
|
|
||||||
|
new_env = []
|
||||||
|
end = []
|
||||||
|
for i in env:
|
||||||
|
#print(i)
|
||||||
|
key = i[0] + i[1]
|
||||||
|
#print(key)
|
||||||
|
if key not in end:
|
||||||
|
end.append(key)
|
||||||
|
new_env.append(i)
|
||||||
|
else:
|
||||||
|
continue
|
||||||
|
#print(new_env)
|
||||||
|
return new_env
|
||||||
|
|
||||||
|
|
||||||
b = root_notify_env()
|
b = root_notify_env()
|
||||||
|
Loading…
Reference in New Issue
Block a user