mirror of
https://github.com/edu4rdshl/gnome-shell.git
synced 2026-07-17 23:24:51 +00:00
js/environment: Always use Shell.util_spawn_async functions if possible
If no child setup is provided then all the shell extensions that use
GLib.spawn_async should actually use the shell spawning utils since we
are supposed to always restore the default nofile rlimit on launched
children.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3293>
(cherry picked from commit 64edd7940d)
This commit is contained in:
parent
6ab1d1c2ec
commit
b910cc62de
1 changed files with 4 additions and 1 deletions
|
|
@ -348,14 +348,17 @@ if (slowdownEnv) {
|
|||
function wrapSpawnFunction(func) {
|
||||
const originalFunc = GLib[func];
|
||||
return function (workingDirectory, argv, envp, flags, childSetup, ...args) {
|
||||
const commonArgs = [workingDirectory, argv, envp, flags];
|
||||
if (childSetup) {
|
||||
logError(new Error(`Using child GLib.${func} with a GLib.SpawnChildSetupFunc ` +
|
||||
'is unsafe and may dead-lock, thus it should never be used from JavaScript. ' +
|
||||
`Shell.${func} can be used to perform default actions or an ` +
|
||||
'async-signal-safe alternative should be used instead'));
|
||||
return originalFunc(...commonArgs, childSetup, ...args);
|
||||
}
|
||||
|
||||
return originalFunc(workingDirectory, argv, envp, flags, childSetup, ...args);
|
||||
const retValue = Shell[`util_${func}`](...commonArgs, ...args);
|
||||
return [true, ...Array.isArray(retValue) ? retValue : [retValue]];
|
||||
};
|
||||
}
|
||||
GLib.spawn_async = wrapSpawnFunction('spawn_async');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue