forked from Mirrors/flatpak-builder
session-helper: Move HostCommand to its own interface
parent
983b2a5db1
commit
41443313ca
|
@ -1403,8 +1403,8 @@ sigterm_handler (gpointer user_data)
|
|||
|
||||
g_dbus_connection_call_sync (data->connection,
|
||||
"org.freedesktop.Flatpak",
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
"org.freedesktop.Flatpak.SessionHelper",
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
"org.freedesktop.Flatpak.Development",
|
||||
"HostCommandSignal",
|
||||
g_variant_new ("(uub)", data->client_pid, SIGTERM, TRUE),
|
||||
NULL,
|
||||
|
@ -1422,8 +1422,8 @@ sigint_handler (gpointer user_data)
|
|||
|
||||
g_dbus_connection_call_sync (data->connection,
|
||||
"org.freedesktop.Flatpak",
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
"org.freedesktop.Flatpak.SessionHelper",
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
"org.freedesktop.Flatpak.Development",
|
||||
"HostCommandSignal",
|
||||
g_variant_new ("(uub)", data->client_pid, SIGINT, TRUE),
|
||||
NULL,
|
||||
|
@ -1471,9 +1471,9 @@ builder_host_spawnv (GFile *dir,
|
|||
|
||||
subscription = g_dbus_connection_signal_subscribe (connection,
|
||||
NULL,
|
||||
"org.freedesktop.Flatpak.SessionHelper",
|
||||
"org.freedesktop.Flatpak.Development",
|
||||
"HostCommandExited",
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
NULL,
|
||||
G_DBUS_SIGNAL_FLAGS_NONE,
|
||||
host_command_exited_cb,
|
||||
|
@ -1535,8 +1535,8 @@ builder_host_spawnv (GFile *dir,
|
|||
|
||||
ret = g_dbus_connection_call_with_unix_fd_list_sync (connection,
|
||||
"org.freedesktop.Flatpak",
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
"org.freedesktop.Flatpak.SessionHelper",
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
"org.freedesktop.Flatpak.Development",
|
||||
"HostCommand",
|
||||
g_variant_new ("(^ay^aay@a{uh}@a{ss}u)",
|
||||
dir ? flatpak_file_get_path_cached (dir) : "",
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
<method name="RequestMonitor">
|
||||
<arg type='ay' name='path' direction='out'/>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
<interface name='org.freedesktop.Flatpak.Development'>
|
||||
|
||||
<!-- This methods let you start processes, sandboxed or not on the
|
||||
host, so its not generally safe to allow access to it to any
|
||||
|
|
|
@ -74,8 +74,8 @@ child_watch_died (GPid pid,
|
|||
signal_variant = g_variant_ref_sink (g_variant_new ("(uu)", client_pid, status));
|
||||
g_dbus_connection_emit_signal (session_bus,
|
||||
pid_data->client,
|
||||
"/org/freedesktop/Flatpak/SessionHelper",
|
||||
"org.freedesktop.Flatpak.SessionHelper",
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
"org.freedesktop.Flatpak.Development",
|
||||
"HostCommandExited",
|
||||
signal_variant,
|
||||
NULL);
|
||||
|
@ -150,7 +150,7 @@ child_setup_func (gpointer user_data)
|
|||
|
||||
|
||||
static gboolean
|
||||
handle_host_command (FlatpakSessionHelper *object,
|
||||
handle_host_command (FlatpakDevelopment *object,
|
||||
GDBusMethodInvocation *invocation,
|
||||
const gchar *arg_cwd_path,
|
||||
const gchar *const *arg_argv,
|
||||
|
@ -302,13 +302,13 @@ handle_host_command (FlatpakSessionHelper *object,
|
|||
pid_data);
|
||||
|
||||
|
||||
flatpak_session_helper_complete_host_command (object, invocation,
|
||||
pid_data->client_pid);
|
||||
flatpak_development_complete_host_command (object, invocation,
|
||||
pid_data->client_pid);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
handle_host_command_signal (FlatpakSessionHelper *object,
|
||||
handle_host_command_signal (FlatpakDevelopment *object,
|
||||
GDBusMethodInvocation *invocation,
|
||||
guint arg_pid,
|
||||
guint arg_signal,
|
||||
|
@ -333,7 +333,7 @@ handle_host_command_signal (FlatpakSessionHelper *object,
|
|||
else
|
||||
kill (pid_data->pid, arg_signal);
|
||||
|
||||
flatpak_session_helper_complete_host_command_signal (object, invocation);
|
||||
flatpak_development_complete_host_command_signal (object, invocation);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -344,13 +344,11 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
gpointer user_data)
|
||||
{
|
||||
FlatpakSessionHelper *helper;
|
||||
FlatpakDevelopment *devel;
|
||||
GError *error = NULL;
|
||||
|
||||
helper = flatpak_session_helper_skeleton_new ();
|
||||
|
||||
g_signal_connect (helper, "handle-request-monitor", G_CALLBACK (handle_request_monitor), NULL);
|
||||
g_signal_connect (helper, "handle-host-command", G_CALLBACK (handle_host_command), NULL);
|
||||
g_signal_connect (helper, "handle-host-command-signal", G_CALLBACK (handle_host_command_signal), NULL);
|
||||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (helper),
|
||||
connection,
|
||||
|
@ -360,6 +358,19 @@ on_bus_acquired (GDBusConnection *connection,
|
|||
g_warning ("error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
|
||||
devel = flatpak_development_skeleton_new ();
|
||||
g_signal_connect (devel, "handle-host-command", G_CALLBACK (handle_host_command), NULL);
|
||||
g_signal_connect (devel, "handle-host-command-signal", G_CALLBACK (handle_host_command_signal), NULL);
|
||||
|
||||
if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (devel),
|
||||
connection,
|
||||
"/org/freedesktop/Flatpak/Development",
|
||||
&error))
|
||||
{
|
||||
g_warning ("error: %s\n", error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
Loading…
Reference in New Issue