From bafacdf62925dc2688462763a5352dbed1573990 Mon Sep 17 00:00:00 2001 From: Olivier Fourdan Date: Mon, 31 Jan 2022 10:40:04 +0100 Subject: [PATCH] ibusManager: Restore the NOFILE limit Use GLib's spawn_async() instead of Gio.SubprocessLauncher() which does not support the child setup function to start ibus-daemon. This way we can restore the NOFILE limit prior to run the ibus-daemon. Part-of: --- js/misc/ibusManager.js | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index d9a9a9d60..d91342c2a 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -70,12 +70,22 @@ var IBusManager = class { _spawn(extraArgs = []) { try { let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs]; - let launcher = Gio.SubprocessLauncher.new(Gio.SubprocessFlags.NONE); // Forward the right X11 Display for ibus-x11 let display = GLib.getenv('GNOME_SETUP_DISPLAY'); + let env = []; + if (display) - launcher.setenv('DISPLAY', display, true); - launcher.spawnv(cmdLine); + env.push('DISPLAY=%s'.format(display)); + GLib.spawn_async( + null, cmdLine, env, + GLib.SpawnFlags.SEARCH_PATH, + () => { + try { + global.context.restore_rlimit_nofile(); + } catch (err) { + } + } + ); } catch (e) { log(`Failed to launch ibus-daemon: ${e.message}`); }