[Concept,01/11] u_boot_pylib: Use PIPE_PTY when an output function is given

Message ID 20260329150140.4095446-2-sjg@u-boot.org
State New
Headers
Series patman: Add workflow tracking for patch series |

Commit Message

Simon Glass March 29, 2026, 3:01 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

When an output_func is provided to run_pipe(), use PIPE_PTY instead of
PIPE for stdout. This ensures the subprocess sees a tty, so interactive
prompts and editors work correctly while still allowing the output to be
captured and processed in real time.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 tools/u_boot_pylib/command.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Patch

diff --git a/tools/u_boot_pylib/command.py b/tools/u_boot_pylib/command.py
index 370713bdf41..54a7ee8e672 100644
--- a/tools/u_boot_pylib/command.py
+++ b/tools/u_boot_pylib/command.py
@@ -117,7 +117,10 @@  def run_pipe(pipe_list, infile=None, outfile=None, capture=False,
         elif stdin_data:
             kwargs['stdin'] = cros_subprocess.PIPE
         if pipeline or capture:
-            kwargs['stdout'] = cros_subprocess.PIPE
+            if output_func:
+                kwargs['stdout'] = cros_subprocess.PIPE_PTY
+            else:
+                kwargs['stdout'] = cros_subprocess.PIPE
         elif outfile:
             kwargs['stdout'] = open(outfile, 'wb')
         if capture_stderr: