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.
This commit is contained in:
Christian Hergert
2023-08-27 14:27:00 -07:00
parent 5c9c20621e
commit 0a12163f6e

View File

@ -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])