[Concept,10/29] patman: Use run_interactive() for git send-email

Message ID 20260501110040.1874719-11-sjg@u-boot.org
State New
Headers
Series patman: Review-flow improvements and shared helpers |

Commit Message

Simon Glass May 1, 2026, 11 a.m. UTC
  From: Simon Glass <sjg@chromium.org>

The output of 'git send-email' arrives in the wrong order: the
'Send this email?' prompt shows up before the email headers because
email_patches() runs the command through cros_subprocess with an echo
callback, which delivers PTY chunks unpredictably.

Switch to run_interactive(), which keeps the child's stdout and stderr
on a real PTY so the prompt and headers appear in the order git
produces them.

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

 tools/u_boot_pylib/gitutil.py | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
  

Patch

diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py
index e216fd8393f..a7db37fd7df 100644
--- a/tools/u_boot_pylib/gitutil.py
+++ b/tools/u_boot_pylib/gitutil.py
@@ -655,14 +655,8 @@  def email_patches(series, cover_fname, args, dry_run, warn_on_error, cc_fname,
     cmd += args
     num_sent = 0
     if not dry_run:
-        def echo_output(_stream, data):
-            os.write(sys.stdout.fileno(), data)
-            return False
-
-        result = command.run_pipe(
-            [cmd], capture=True, output_func=echo_output,
-            raise_on_error=False, cwd=cwd, merge_stderr=True)
-        num_sent = result.stdout.count('Result: ')
+        captured = command.run_interactive(cmd, cwd)
+        num_sent = captured.count('Result: ')
     cmd_str = ' '.join([f'"{x}"' if ' ' in x and '"' not in x else x
                         for x in cmd])
     return cmd_str, num_sent