diff --git a/src/com.steampowered.PressureVessel.Launcher1.xml b/src/com.steampowered.PressureVessel.Launcher1.xml index ee47e85ce995de5462f41ab9917c32c0d961c17b..8313f578758a88b094741f76db55e3e49dcdc977 100644 --- a/src/com.steampowered.PressureVessel.Launcher1.xml +++ b/src/com.steampowered.PressureVessel.Launcher1.xml @@ -138,6 +138,15 @@ <arg type='u' name='wait_status'/> </signal> + <!-- + Terminate: + + Stop listening for Launch and SendSignal requests, terminate + child processes if any, and shut down gracefully. + --> + <method name="Terminate"> + </method> + </interface> </node> diff --git a/src/launcher.c b/src/launcher.c index 522797cba2f7b07506f222eab59a7542281267dc..2a98a3ebcb7eff1903c3b2c70d82124277bcea9f 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -418,6 +418,16 @@ handle_send_signal (PvLauncher1 *object, return TRUE; } +static gboolean +handle_terminate (PvLauncher1 *object, + GDBusMethodInvocation *invocation) +{ + terminate_children (SIGTERM); + pv_launcher1_complete_terminate (object, invocation); + unref_skeleton_in_timeout (); + return TRUE; /* handled */ +} + static void name_owner_changed (GDBusConnection *connection, const gchar *sender_name, @@ -480,6 +490,8 @@ export_launcher (GDBusConnection *connection, G_CALLBACK (handle_launch), NULL); g_signal_connect (launcher, "handle-send-signal", G_CALLBACK (handle_send_signal), NULL); + g_signal_connect (launcher, "handle-terminate", + G_CALLBACK (handle_terminate), NULL); } if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (launcher),