From 0a12163f6ec195ec724a49d30f295fea3b8aca77 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 27 Aug 2023 14:27:00 -0700 Subject: [PATCH] sysprof: use flatpak-spawn when inside of flatpak Unless the argv already is calling flatpak-spawn, try to run the process through the host using flatpak-spawn. --- src/sysprof/sysprof-recording-template.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/sysprof/sysprof-recording-template.c b/src/sysprof/sysprof-recording-template.c index 16c97aa0..9716601e 100644 --- a/src/sysprof/sysprof-recording-template.c +++ b/src/sysprof/sysprof-recording-template.c @@ -521,6 +521,15 @@ sysprof_recording_template_apply (SysprofRecordingTemplate *self, } spawnable = sysprof_spawnable_new (); + + if (g_file_test ("/.flatpak-info", G_FILE_TEST_EXISTS) && + !g_strv_contains ((const char * const *)argv, "flatpak-spawn")) + { + sysprof_spawnable_append_argv (spawnable, "flatpak-spawn"); + sysprof_spawnable_append_argv (spawnable, "--host"); + sysprof_spawnable_append_argv (spawnable, "--watch-bus"); + } + sysprof_spawnable_append_args (spawnable, (const char * const *)argv); if (self->cwd && self->cwd[0])