[gnome-builder/gnome-builder-3-32] flatpak: avoid duplicate --env entries
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder/gnome-builder-3-32] flatpak: avoid duplicate --env entries
- Date: Fri, 26 Apr 2019 21:41:42 +0000 (UTC)
commit aec7b135c3cfe4c582fa3bade664da594935c449
Author: Christian Hergert <chergert redhat com>
Date: Fri Apr 26 13:40:11 2019 -0700
flatpak: avoid duplicate --env entries
src/plugins/flatpak/gbp-flatpak-runner.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
---
diff --git a/src/plugins/flatpak/gbp-flatpak-runner.c b/src/plugins/flatpak/gbp-flatpak-runner.c
index a1c3a47fc..15a009260 100644
--- a/src/plugins/flatpak/gbp-flatpak-runner.c
+++ b/src/plugins/flatpak/gbp-flatpak-runner.c
@@ -73,6 +73,21 @@ gbp_flatpak_runner_create_launcher (IdeRunner *runner)
NULL);
}
+static gboolean
+contains_argv (IdeSubprocessLauncher *launcher,
+ const gchar *arg)
+{
+ const gchar * const *args;
+
+ if (arg == NULL)
+ return TRUE;
+
+ if (!(args = ide_subprocess_launcher_get_argv (launcher)))
+ return FALSE;
+
+ return g_strv_contains (args, arg);
+}
+
static void
gbp_flatpak_runner_fixup_launcher (IdeRunner *runner,
IdeSubprocessLauncher *launcher)
@@ -161,7 +176,9 @@ gbp_flatpak_runner_fixup_launcher (IdeRunner *runner,
for (guint j = 0; environ_[j]; j++)
{
g_autofree gchar *arg = g_strdup_printf ("--env=%s", environ_[j]);
- ide_subprocess_launcher_insert_argv (launcher, i++, arg);
+
+ if (!contains_argv (launcher, arg))
+ ide_subprocess_launcher_insert_argv (launcher, i++, arg);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]