util: Don't double-fork when spawning from Alt-F2

This breaks polkit.

See http://bugzilla.redhat.com//show_bug.cgi?id=819275

https://bugzilla.gnome.org/show_bug.cgi?id=675789
This commit is contained in:
Colin Walters 2012-05-09 21:23:19 -04:00
parent 66e470e073
commit 02e4726ba6

View File

@ -83,9 +83,10 @@ function spawnCommandLine(command_line) {
// this will throw an error. // this will throw an error.
function trySpawn(argv) function trySpawn(argv)
{ {
var success, pid;
try { try {
GLib.spawn_async(null, argv, null, [success, pid] = GLib.spawn_async(null, argv, null,
GLib.SpawnFlags.SEARCH_PATH, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
null, null); null, null);
} catch (err) { } catch (err) {
if (err.code == GLib.SpawnError.G_SPAWN_ERROR_NOENT) { if (err.code == GLib.SpawnError.G_SPAWN_ERROR_NOENT) {
@ -101,6 +102,10 @@ function trySpawn(argv)
throw err; throw err;
} }
// Dummy child watch; we don't want to double-fork internally
// because then we lose the parent-child relationship, which
// can break polkit. See https://bugzilla.redhat.com//show_bug.cgi?id=819275
GLib.child_watch_add(GLib.PRIORITY_DEFAULT, pid, function () {}, null);
} }
// trySpawnCommandLine: // trySpawnCommandLine: