[gnome-builder] flatpak: include XDG_RUNTIME_DIR when launching flatpak processes



commit f1073a05a98a1114b60bf092370848f98b1bbda2
Author: Christian Hergert <chergert redhat com>
Date:   Tue Nov 24 11:53:36 2020 -0800

    flatpak: include XDG_RUNTIME_DIR when launching flatpak processes
    
    We can inject the XDG_RUNTIME_DIR when launching processes from either
    the flatpak build or flatpak run commands to prevent failing to allocate an
    instance id in the lower layers of flatpak.
    
    Fixes #1339

 src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c 
b/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
index 675eb30dc..791cf4c5e 100644
--- a/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
+++ b/src/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
@@ -38,6 +38,7 @@ gbp_flatpak_subprocess_launcher_spawn (IdeSubprocessLauncher  *launcher,
 {
   GbpFlatpakSubprocessLauncher *self = (GbpFlatpakSubprocessLauncher *)launcher;
   g_autofree gchar *build_dir_option = NULL;
+  g_autofree gchar *xdg_runtime_dir = NULL;
   const gchar * const * envp;
   const gchar * const * argv;
   IdeSubprocess *ret;
@@ -112,13 +113,18 @@ gbp_flatpak_subprocess_launcher_spawn (IdeSubprocessLauncher  *launcher,
 
   build_dir_option = g_strdup_printf ("--build-dir=%s",
                                       ide_subprocess_launcher_get_cwd (launcher));
+  xdg_runtime_dir = g_strdup_printf ("--env=XDG_RUNTIME_DIR=%s",
+                                     g_get_user_runtime_dir ());
 
   /*
    * Since this can be called multiple times, we have to avoid re-adding
-   * the --build-dir= parameters a second (or third, or fourth) time.
+   * the --build-dir= and --env=XDG_RUNTIME_DIR parameters a second (or third,
+   * or fourth) time.
    */
   if (!g_strv_contains (argv, build_dir_option))
     ide_subprocess_launcher_insert_argv (launcher, argpos, build_dir_option);
+  if (!g_strv_contains (argv, xdg_runtime_dir))
+    ide_subprocess_launcher_insert_argv (launcher, argpos, xdg_runtime_dir);
 
 apply_env:
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]