[gnome-builder/wip/mwleeds/dupe-argv] flatpak: don't add duplicate args to subprocess launcher



commit 547478ccae10e9166dc16ba983ed725a3d4bcf21
Author: Matthew Leeds <mleeds redhat com>
Date:   Fri Feb 17 15:32:49 2017 -0600

    flatpak: don't add duplicate args to subprocess launcher
    
    gbp_flatpak_subprocess_launcher_spawn() adds any environment variables
    that have been set in the launcher to the flatpak-build command line
    arguments so they are set in the subprocess. But if the launcher is used
    to spawn multiple processes, the --env arguments are duplicated. This
    commit fixes that by checking for them in the list before adding them.

 plugins/flatpak/gbp-flatpak-subprocess-launcher.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-subprocess-launcher.c 
b/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
index 73c9cc9..6975733 100644
--- a/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
+++ b/plugins/flatpak/gbp-flatpak-subprocess-launcher.c
@@ -75,7 +75,8 @@ gbp_flatpak_subprocess_launcher_spawn (IdeSubprocessLauncher  *launcher,
       for (guint i = 0; envp[i] != NULL; i++)
         {
           g_autofree gchar *arg = g_strdup_printf ("--env=%s", envp[i]);
-          ide_subprocess_launcher_insert_argv (launcher, argpos, arg);
+          if (!g_strv_contains (argv, arg))
+            ide_subprocess_launcher_insert_argv (launcher, argpos, arg);
         }
     }
 


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