fix(linux): Don't start ibus-daemon multiple times

This change adds a 1s sleep after restarting ibus before checking
that it actually runs. Hopefully this will solve the problem. Since
this bug is hard to reproduce, we also log a critical error for the
other code path this could happen.

Fixes #6237.
This commit is contained in:
Eberhard Beilharz 2022-02-24 11:47:56 +01:00
parent 9b46242d32
commit e30c00733a
No known key found for this signature in database
GPG key ID: E9140597606020D3

View file

@ -91,7 +91,9 @@ def _verify_ibus_daemon():
ps = subprocess.run(('ps', '--user', user, '-o', 's=', '-o', 'cmd'), stdout=subprocess.PIPE).stdout
if not re.search('^[^ZT] ibus-daemon .*--xim.*', ps.decode('utf-8'), re.MULTILINE):
_start_ibus_daemon(realuser)
except subprocess.CalledProcessError:
except subprocess.CalledProcessError as e:
# Log criticial error in order to track down #6237
logging.critical('getting ibus-daemon failed (%s: %s)', type(e), e.args)
_start_ibus_daemon(realuser)
@ -130,6 +132,7 @@ def restart_ibus(bus=None):
except Exception as e:
logging.warning("Failed to restart IBus")
logging.warning(e)
time.sleep(1) # 1s
_verify_ibus_daemon()