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: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2117>
This commit is contained in:
parent
7c394b0512
commit
bafacdf629
@ -70,12 +70,22 @@ var IBusManager = class {
|
|||||||
_spawn(extraArgs = []) {
|
_spawn(extraArgs = []) {
|
||||||
try {
|
try {
|
||||||
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
|
let cmdLine = ['ibus-daemon', '--panel', 'disable', ...extraArgs];
|
||||||
let launcher = Gio.SubprocessLauncher.new(Gio.SubprocessFlags.NONE);
|
|
||||||
// Forward the right X11 Display for ibus-x11
|
// Forward the right X11 Display for ibus-x11
|
||||||
let display = GLib.getenv('GNOME_SETUP_DISPLAY');
|
let display = GLib.getenv('GNOME_SETUP_DISPLAY');
|
||||||
|
let env = [];
|
||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
launcher.setenv('DISPLAY', display, true);
|
env.push('DISPLAY=%s'.format(display));
|
||||||
launcher.spawnv(cmdLine);
|
GLib.spawn_async(
|
||||||
|
null, cmdLine, env,
|
||||||
|
GLib.SpawnFlags.SEARCH_PATH,
|
||||||
|
() => {
|
||||||
|
try {
|
||||||
|
global.context.restore_rlimit_nofile();
|
||||||
|
} catch (err) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log(`Failed to launch ibus-daemon: ${e.message}`);
|
log(`Failed to launch ibus-daemon: ${e.message}`);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user