[gnome-shell] util: Don't double-fork when spawning from Alt-F2



commit 02e4726ba62659b4cdeca5274d76ba8f14edb768
Author: Colin Walters <walters verbum org>
Date:   Wed May 9 21:23:19 2012 -0400

    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

 js/misc/util.js |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/js/misc/util.js b/js/misc/util.js
index 8673f83..8839ed6 100644
--- a/js/misc/util.js
+++ b/js/misc/util.js
@@ -83,10 +83,11 @@ function spawnCommandLine(command_line) {
 // this will throw an error.
 function trySpawn(argv)
 {
+    var success, pid;
     try {
-        GLib.spawn_async(null, argv, null,
-                         GLib.SpawnFlags.SEARCH_PATH,
-                         null, null);
+        [success, pid] = GLib.spawn_async(null, argv, null,
+                                          GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.DO_NOT_REAP_CHILD,
+                                          null, null);
     } catch (err) {
         if (err.code == GLib.SpawnError.G_SPAWN_ERROR_NOENT) {
             err.message = _("Command not found");
@@ -101,6 +102,10 @@ function trySpawn(argv)
 
         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:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]