ibusManager: Avoid double fork triggering parent death in ibus

Use DO_NOT_REAP_CHILD to avoid a double-fork internally since ibus-daemon
refuses to start with init as its parent.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2345>
This commit is contained in:
oreo639 2022-06-27 13:38:55 -07:00 committed by Florian Müllner
parent be52477610
commit 8e87ff2975

View File

@ -109,9 +109,11 @@ var IBusManager = class {
this._tryAppendEnv(env, 'COMPOSE_FILE'); this._tryAppendEnv(env, 'COMPOSE_FILE');
this._tryAppendEnv(env, 'DISPLAY'); this._tryAppendEnv(env, 'DISPLAY');
GLib.spawn_async( // Use DO_NOT_REAP_CHILD to avoid adouble-fork internally
// since ibus-daemon refuses to start with init as its parent.
const [success_, pid] = GLib.spawn_async(
null, cmdLine, env, null, cmdLine, env,
GLib.SpawnFlags.SEARCH_PATH, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
() => { () => {
try { try {
global.context.restore_rlimit_nofile(); global.context.restore_rlimit_nofile();
@ -119,6 +121,11 @@ var IBusManager = class {
} }
} }
); );
GLib.child_watch_add(
GLib.PRIORITY_DEFAULT,
pid,
() => GLib.spawn_close_pid(pid)
);
} catch (e) { } catch (e) {
log(`Failed to launch ibus-daemon: ${e.message}`); log(`Failed to launch ibus-daemon: ${e.message}`);
} }