mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-06 07:58:44 +02:00
gdesktopappinfo: add g_desktop_app_info_launch_uris_as_manager_with_fds variant
Add an app-launching function which allows standard file descriptors to be passed to the child process. This will be used by gnome-shell to pass systemd journal descriptors as stdout/stderr. gnome-shell's child_setup function can then be eliminated, which will enable use of the posix_spawn optimized gspawn codepath for desktop app launching.
This commit is contained in:
@@ -788,6 +788,46 @@ test_show_in (void)
|
||||
assert_shown ("gcr-prompter.desktop", TRUE, "KDE:GNOME-Classic");
|
||||
}
|
||||
|
||||
/* Test g_desktop_app_info_launch_uris_as_manager() and
|
||||
* g_desktop_app_info_launch_uris_as_manager_with_fds()
|
||||
*/
|
||||
static void
|
||||
test_launch_as_manager (void)
|
||||
{
|
||||
GDesktopAppInfo *appinfo;
|
||||
GError *error = NULL;
|
||||
gboolean retval;
|
||||
const gchar *path;
|
||||
|
||||
if (g_getenv ("DISPLAY") == NULL || g_getenv ("DISPLAY")[0] == '\0')
|
||||
{
|
||||
g_test_skip ("No DISPLAY. Skipping test.");
|
||||
return;
|
||||
}
|
||||
|
||||
path = g_test_get_filename (G_TEST_DIST, "appinfo-test.desktop", NULL);
|
||||
appinfo = g_desktop_app_info_new_from_filename (path);
|
||||
g_assert_nonnull (appinfo);
|
||||
|
||||
retval = g_desktop_app_info_launch_uris_as_manager (appinfo, NULL, NULL, 0,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_true (retval);
|
||||
|
||||
retval = g_desktop_app_info_launch_uris_as_manager_with_fds (appinfo,
|
||||
NULL, NULL, 0,
|
||||
NULL, NULL,
|
||||
NULL, NULL,
|
||||
-1, -1, -1,
|
||||
&error);
|
||||
g_assert_no_error (error);
|
||||
g_assert_true (retval);
|
||||
|
||||
g_object_unref (appinfo);
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc,
|
||||
char *argv[])
|
||||
@@ -816,6 +856,7 @@ main (int argc,
|
||||
g_test_add_func ("/desktop-app-info/search", test_search);
|
||||
g_test_add_func ("/desktop-app-info/implements", test_implements);
|
||||
g_test_add_func ("/desktop-app-info/show-in", test_show_in);
|
||||
g_test_add_func ("/desktop-app-info/launch-as-manager", test_launch_as_manager);
|
||||
|
||||
result = g_test_run ();
|
||||
|
||||
|
Reference in New Issue
Block a user