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:
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.DesktopAppI nfo.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.DesktopAppI nfo.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.