[gnome-builder] libide-foundry: port subprocess helper to IdeRunContext



commit 696c47ac3363d9379760faea983fdc6e4cf5ce6c
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jul 11 20:51:39 2022 -0700

    libide-foundry: port subprocess helper to IdeRunContext

 src/libide/foundry/ide-foundry-global.c | 19 ++++++++++++++++---
 src/libide/foundry/ide-foundry-global.h |  6 +++---
 2 files changed, 19 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/foundry/ide-foundry-global.c b/src/libide/foundry/ide-foundry-global.c
index 1051118ed..ccc38877c 100644
--- a/src/libide/foundry/ide-foundry-global.c
+++ b/src/libide/foundry/ide-foundry-global.c
@@ -32,9 +32,23 @@
 #include "ide-build-manager.h"
 #include "ide-foundry-global.h"
 #include "ide-pipeline.h"
+#include "ide-run-context.h"
 #include "ide-runtime-manager.h"
 #include "ide-runtime.h"
 
+static IdeSubprocessLauncher *
+create_host_launcher (void)
+{
+  g_autoptr(IdeRunContext) run_context = ide_run_context_new ();
+
+  /* To be like the build pipeline, we do not add the "minimal"
+   * environment as that would give display access which the
+   * build pipeline generally does not have.
+   */
+  ide_run_context_push_host (run_context);
+  return ide_run_context_end (run_context, NULL);
+}
+
 /**
  * ide_foundry_get_launcher_for_context:
  * @context: an #IdeContext
@@ -113,14 +127,13 @@ ide_foundry_get_launcher_for_context (IdeContext  *context,
       if (program_path != NULL ||
           ide_runtime_contains_program_in_path (host, program_name, NULL))
         {
-          launcher = ide_runtime_create_launcher (host, NULL);
+          launcher = create_host_launcher ();
           IDE_GOTO (setup_launcher);
         }
     }
   else if (program_path != NULL)
     {
-      launcher = ide_subprocess_launcher_new (0);
-      ide_subprocess_launcher_set_run_on_host (launcher, TRUE);
+      launcher = create_host_launcher ();
       IDE_GOTO (setup_launcher);
     }
 
diff --git a/src/libide/foundry/ide-foundry-global.h b/src/libide/foundry/ide-foundry-global.h
index 6ad6918a9..e8f0b07c2 100644
--- a/src/libide/foundry/ide-foundry-global.h
+++ b/src/libide/foundry/ide-foundry-global.h
@@ -29,13 +29,13 @@
 
 G_BEGIN_DECLS
 
-IDE_AVAILABLE_IN_43
+IDE_AVAILABLE_IN_ALL
 int                    ide_foundry_bytes_to_memfd           (GBytes      *bytes,
                                                              const char  *name);
-IDE_AVAILABLE_IN_43
+IDE_AVAILABLE_IN_ALL
 int                    ide_foundry_file_to_memfd            (GFile       *file,
                                                              const char  *name);
-IDE_AVAILABLE_IN_43
+IDE_AVAILABLE_IN_ALL
 IdeSubprocessLauncher *ide_foundry_get_launcher_for_context (IdeContext  *context,
                                                              const char  *program_name,
                                                              const char  *bundled_program_path,


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