mirror of
https://github.com/keymanapp/keyman.git
synced 2026-08-13 20:29:24 +00:00
fix(linux): Prevent exception if neither USER, LOGNAME nor SUDO_USER set
Closes #9542.
(cherry picked from commit ffa3324be2)
This commit is contained in:
parent
ed0956fe8d
commit
a5a9c24acd
1 changed files with 4 additions and 0 deletions
|
|
@ -88,6 +88,10 @@ def verify_ibus_daemon(start):
|
|||
elif not user:
|
||||
user = os.environ.get('LOGNAME')
|
||||
|
||||
if not user:
|
||||
logging.debug('Neither SUDO_USER, USER nor LOGNAME set. Skipping ibus-daemon check.')
|
||||
return
|
||||
|
||||
try:
|
||||
ps = subprocess.run(('ps', '--user', user, '-o', 's=', '-o', 'cmd'), stdout=subprocess.PIPE).stdout
|
||||
ibus_daemons = re.findall('^[^ZT] ibus-daemon .*--xim.*', ps.decode('utf-8'), re.MULTILINE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue