Comment 3 for bug 1259721

Revision history for this message
Martin Pitt (pitti) wrote :

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.