launch_uris() indeed inherits stdout/stderr to the child, which is
usually what you want. But not in this case, when we exit the parent
process before the child.

The launch_uris_as_manager() method gives more flexibility, in
particular you can give custom GLib.SpawnFlags to it (launch_uris() just
uses GLib.SpawnFlags.SEARCH_PATH). Unfortunately this is currently
rather awkward to use from Python as it's missing some annotations:

$ python -c "from gi.repository import GLib, Gio; 
Gio.DesktopAppInfo.new('gcalctool.desktop').launch_uris_as_manager([], None, 
GLib.SpawnFlags.STDOUT_TO_DEV_NULL, None, None, None, None)" | tee /tmp/foo
Traceback (most recent call last):
  File "<string>", line 1, in <module>
TypeError: Argument 2 does not allow None as a value

If I hack the annotations to add the missing allow-none's, it works
fine:

$ python -c "from gi.repository import GLib, Gio;
Gio.DesktopAppInfo.new('gcalctool.desktop').launch_uris_as_manager([],
None, GLib.SpawnFlags.SEARCH_PATH | GLib.SpawnFlags.STDOUT_TO_DEV_NULL,
None, None, None, None)" | tee /tmp/foo

This now immediately returns.

** Also affects: glib2.0 (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: glib2.0 (Ubuntu)
   Importance: Undecided => Medium

** Changed in: glib2.0 (Ubuntu)
       Status: New => In Progress

** Changed in: glib2.0 (Ubuntu)
     Assignee: (unassigned) => Martin Pitt (pitti)

** Package changed: glib2.0 (Ubuntu) => glib

** Also affects: gobject-introspection (Ubuntu)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1259721

Title:
  Executing autopilot test suite fails to close when piped to tee

To manage notifications about this bug go to:
https://bugs.launchpad.net/autopilot/+bug/1259721/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to