[gnome-builder] plugins/podman: fix --tty parameter



commit 90e78d246e3c080ae52026655e5666b7b669a63c
Author: Christian Hergert <chergert redhat com>
Date:   Sun Sep 25 18:31:08 2022 -0700

    plugins/podman: fix --tty parameter
    
    We would never match with how this was previously as the items would always
    be removed when merging layers.
    
    Related #1814

 src/plugins/podman/gbp-podman-runtime.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/plugins/podman/gbp-podman-runtime.c b/src/plugins/podman/gbp-podman-runtime.c
index a45e3a651..4bd7b47a2 100644
--- a/src/plugins/podman/gbp-podman-runtime.c
+++ b/src/plugins/podman/gbp-podman-runtime.c
@@ -118,6 +118,7 @@ gbp_podman_runtime_run_handler_cb (IdeRunContext       *run_context,
                                    GError             **error)
 {
   GbpPodmanRuntime *self = user_data;
+  gboolean has_tty = FALSE;
   int max_dest_fd;
 
   IDE_ENTRY;
@@ -128,6 +129,12 @@ gbp_podman_runtime_run_handler_cb (IdeRunContext       *run_context,
   g_assert (env != NULL);
   g_assert (IDE_IS_UNIX_FD_MAP (unix_fd_map));
 
+  /* Make sure that we request TTY ioctls if necessary */
+  if (ide_unix_fd_map_stdin_isatty (unix_fd_map) ||
+      ide_unix_fd_map_stdout_isatty (unix_fd_map) ||
+      ide_unix_fd_map_stderr_isatty (unix_fd_map))
+    has_tty = TRUE;
+
   /* Make sure we can pass the FDs down */
   if (!ide_run_context_merge_unix_fd_map (run_context, unix_fd_map, error))
     IDE_RETURN (FALSE);
@@ -139,9 +146,7 @@ gbp_podman_runtime_run_handler_cb (IdeRunContext       *run_context,
   ide_run_context_append_formatted (run_context, "--user=%s", g_get_user_name ());
 
   /* Make sure that we request TTY ioctls if necessary */
-  if (ide_unix_fd_map_stdin_isatty (unix_fd_map) ||
-      ide_unix_fd_map_stdout_isatty (unix_fd_map) ||
-      ide_unix_fd_map_stderr_isatty (unix_fd_map))
+  if (has_tty)
     ide_run_context_append_argv (run_context, "--tty");
 
   /* Specify working directory inside the container */


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