[gnome-builder/wip/gtk4-port: 1704/1774] libide/foundry: use run context to create host launcher




commit 4d78eddd84337e49833f15544eb643f02ca7a87c
Author: Christian Hergert <chergert redhat com>
Date:   Tue Jun 28 12:50:44 2022 -0700

    libide/foundry: use run context to create host launcher

 src/libide/foundry/ide-foundry-global.c | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 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);
     }
 


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