[gnome-builder] libide/foundry: connect commands to pipeline PTY



commit 4996b5321dc4fc49d093c8a36507b19eef8ddb5a
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 15 15:20:30 2022 -0700

    libide/foundry: connect commands to pipeline PTY
    
    When creating the subprocess launcher, we want to ensure that the result
    ends up in the proper PTY (the one owned by the build pipeline).

 src/libide/foundry/ide-pipeline-stage-command.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
---
diff --git a/src/libide/foundry/ide-pipeline-stage-command.c b/src/libide/foundry/ide-pipeline-stage-command.c
index 87a6d4707..7dec06a60 100644
--- a/src/libide/foundry/ide-pipeline-stage-command.c
+++ b/src/libide/foundry/ide-pipeline-stage-command.c
@@ -79,8 +79,9 @@ ide_pipeline_stage_command_build_async (IdePipelineStage    *stage,
                                         gpointer             user_data)
 {
   IdePipelineStageCommand *self = (IdePipelineStageCommand *)stage;
-  g_autoptr(IdeRunContext) run_context = NULL;
+  g_autoptr(IdeSubprocessLauncher) launcher = NULL;
   g_autoptr(IdeSubprocess) subprocess = NULL;
+  g_autoptr(IdeRunContext) run_context = NULL;
   g_autoptr(IdeTask) task = NULL;
   g_autoptr(GError) error = NULL;
 
@@ -102,11 +103,13 @@ ide_pipeline_stage_command_build_async (IdePipelineStage    *stage,
 
   run_context = ide_pipeline_create_run_context (pipeline, self->build_command);
 
-  if (!(subprocess = ide_run_context_spawn (run_context, &error)))
-    {
-      ide_task_return_error (task, g_steal_pointer (&error));
-      IDE_EXIT;
-    }
+  if (!(launcher = ide_run_context_end (run_context, &error)))
+    IDE_GOTO (handle_error);
+
+  ide_pipeline_attach_pty (pipeline, launcher);
+
+  if (!(subprocess = ide_subprocess_launcher_spawn (launcher, NULL, &error)))
+    IDE_GOTO (handle_error);
 
   ide_subprocess_send_signal_upon_cancel (subprocess, cancellable, SIGKILL);
 
@@ -116,6 +119,11 @@ ide_pipeline_stage_command_build_async (IdePipelineStage    *stage,
                                    g_steal_pointer (&task));
 
   IDE_EXIT;
+
+handle_error:
+  ide_task_return_error (task, g_steal_pointer (&error));
+
+  IDE_EXIT;
 }
 
 static gboolean


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