Commit 5ce96e7a authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

menu: redirect child stdout/stderr to journal

parent acb63d07
......@@ -112,6 +112,7 @@ LIBWNCK_REQUIRED=3.4.6
LIBGNOME_MENU_REQUIRED=3.7.90
LIBECAL_REQUIRED=3.5.3
LIBEDATASERVER_REQUIRED=3.5.3
LIBSYSTEMD_REQUIRED=230
CAIRO_REQUIRED=1.0.0
GWEATHER_REQUIRED=3.17.1
DCONF_REQUIRED=0.13.4
......@@ -159,6 +160,7 @@ PKG_CHECK_MODULES([MENU], [
gio-unix-2.0 >= $GLIB_REQUIRED
gtk+-3.0 >= $GTK_REQUIRED
libgnome-menu-3.0 >= $LIBGNOME_MENU_REQUIRED
libsystemd >= $LIBSYSTEMD_REQUIRED
])
PKG_CHECK_MODULES([NOTIFICATION_AREA], [
......
......@@ -19,9 +19,36 @@
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <systemd/sd-journal.h>
#include "gp-menu-utils.h"
static void
child_setup (gpointer user_data)
{
GAppInfo *info;
const gchar *id;
gint stdout_fd;
gint stderr_fd;
info = G_APP_INFO (user_data);
id = g_app_info_get_id (info);
stdout_fd = sd_journal_stream_fd (id, LOG_INFO, FALSE);
if (stdout_fd >= 0)
{
dup2 (stdout_fd, STDOUT_FILENO);
close (stdout_fd);
}
stderr_fd = sd_journal_stream_fd (id, LOG_WARNING, FALSE);
if (stderr_fd >= 0)
{
dup2 (stderr_fd, STDERR_FILENO);
close (stderr_fd);
}
}
static void
pid_cb (GDesktopAppInfo *info,
GPid pid,
......@@ -41,7 +68,7 @@ gp_menu_launch_app_info (GDesktopAppInfo *app_info)
error = NULL;
ret = g_desktop_app_info_launch_uris_as_manager (app_info, NULL, NULL,
flags, NULL, NULL,
flags, child_setup, app_info,
pid_cb, NULL,
&error);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment