[gnome-builder] plugins: ignore stdin/stdout when using which



commit e7bffe5b5cbc8b3d854c9c40810307f8f624e495
Author: Christian Hergert <chergert redhat com>
Date:   Thu Jul 14 20:46:59 2022 -0700

    plugins: ignore stdin/stdout when using which

 src/plugins/host/gbp-host-runtime.c       | 3 +++
 src/plugins/jhbuild/gbp-jhbuild-runtime.c | 3 +++
 2 files changed, 6 insertions(+)
---
diff --git a/src/plugins/host/gbp-host-runtime.c b/src/plugins/host/gbp-host-runtime.c
index cc6782504..5a4c3c48a 100644
--- a/src/plugins/host/gbp-host-runtime.c
+++ b/src/plugins/host/gbp-host-runtime.c
@@ -62,6 +62,9 @@ gbp_host_runtime_flatpak_contains_program_in_path (IdeRuntime   *runtime,
   ide_run_context_append_argv (run_context, "which");
   ide_run_context_append_argv (run_context, program);
 
+  ide_run_context_take_fd (run_context, -1, STDOUT_FILENO);
+  ide_run_context_take_fd (run_context, -1, STDERR_FILENO);
+
   if ((subprocess = ide_run_context_spawn (run_context, &error)))
     ret = ide_subprocess_wait_check (subprocess, cancellable, NULL);
 
diff --git a/src/plugins/jhbuild/gbp-jhbuild-runtime.c b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
index cc36c1e2f..5d909dd34 100644
--- a/src/plugins/jhbuild/gbp-jhbuild-runtime.c
+++ b/src/plugins/jhbuild/gbp-jhbuild-runtime.c
@@ -138,6 +138,9 @@ gbp_jhbuild_runtime_contains_program_in_path (IdeRuntime   *runtime,
   ide_run_context_append_argv (run_context, "which");
   ide_run_context_append_argv (run_context, program);
 
+  ide_run_context_take_fd (run_context, -1, STDOUT_FILENO);
+  ide_run_context_take_fd (run_context, -1, STDERR_FILENO);
+
   if (!(subprocess = ide_run_context_spawn (run_context, &error)))
     {
       g_warning ("Failed to spawn subprocess: %s", error->message);


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