[Xfce4-commits] [xfce/xfce4-session] 05/11: dbus-clients: save restart command
noreply at xfce.org
noreply at xfce.org
Tue Jun 28 09:26:08 CEST 2016
This is an automated email from the git hooks/post-receive script.
eric pushed a commit to branch master
in repository xfce/xfce4-session.
commit 8c0fff77b0273039e6789a68bdaaf3d9891da76f
Author: Eric Koegel <eric.koegel at gmail.com>
Date: Sun Jun 26 11:58:39 2016 +0300
dbus-clients: save restart command
Use ps to collect the command line from dbus clients so we have
a way to restart them, if desired.
---
xfce4-session/xfsm-client.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/xfce4-session/xfsm-client.c b/xfce4-session/xfsm-client.c
index 2f93f93..9e590c6 100644
--- a/xfce4-session/xfsm-client.c
+++ b/xfce4-session/xfsm-client.c
@@ -378,6 +378,35 @@ xfsm_client_get_service_name (XfsmClient *client)
+static void
+xfsm_client_get_command_line (XfsmClient *client)
+{
+ XfsmProperties *properties = client->properties;
+ gchar *input;
+ gchar *output = NULL;
+ gint exit_status;
+ GError *error = NULL;
+
+ input = g_strdup_printf ("ps -p %u -o args=", properties->pid);
+
+ if(g_spawn_command_line_sync (input, &output, NULL, &exit_status, &error))
+ {
+ gchar **strv = g_new0(gchar*, 2);
+
+ strv[0] = output;
+ strv[1] = NULL;
+
+ xfsm_verbose ("%s restart command %s", input, output);
+ xfsm_properties_set_strv (properties, "RestartCommand", strv);
+ }
+ else
+ {
+ xfsm_verbose ("Failed to get the process command line, error was %s", error->message);
+ }
+}
+
+
+
void
xfsm_client_set_pid (XfsmClient *client,
pid_t pid)
@@ -399,6 +428,9 @@ xfsm_client_set_pid (XfsmClient *client,
/* store the string as well (so we can export it over dbus */
xfsm_properties_set_string (properties, "ProcessID", pid_str);
+ /* get the command line for the process so we can restart it if needed */
+ xfsm_client_get_command_line (client);
+
g_free (pid_str);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list