From patchwork Sun Mar 29 15:01:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 2078 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774796527; bh=LqPQZynybYrbSqmtBFgOQhdyBUzdQMPlJDu1/u8XYl0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QAF7ajJ+pCg9OeaZ7teCTpzhBx3XahCtkOYeMFESDCgnnYQzD+76RNwUukm+wFw62 vGjR/JvbOcAtfzJ4rQDy+RXlNqmjS3tRMLSBUv24/n59e7BYtYfU7lM43yOvfZ7QwV wRh43QtNEJBbN5KXzJHgL+tOYQoWxDEgwKiyZ2waK4LQJScPevw5lTgKBkSBj/72H+ dbXL10xZtbS4BihgcRnGvKbxI1sEN9nz6CTnWENngTpQvWNEnEpSksLM6gBqZxyIXA 9bTI98cIYd9hWHHzyCFJ+FmdCvBiHHDaKv48d7ne3NW4lE5BR7mHnXJROioBx2Rght tqKdkAmd5Isiw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 598526A2D4 for ; Sun, 29 Mar 2026 09:02:07 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 1C5FaETEvhgD for ; Sun, 29 Mar 2026 09:02:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774796527; bh=LqPQZynybYrbSqmtBFgOQhdyBUzdQMPlJDu1/u8XYl0=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=QAF7ajJ+pCg9OeaZ7teCTpzhBx3XahCtkOYeMFESDCgnnYQzD+76RNwUukm+wFw62 vGjR/JvbOcAtfzJ4rQDy+RXlNqmjS3tRMLSBUv24/n59e7BYtYfU7lM43yOvfZ7QwV wRh43QtNEJBbN5KXzJHgL+tOYQoWxDEgwKiyZ2waK4LQJScPevw5lTgKBkSBj/72H+ dbXL10xZtbS4BihgcRnGvKbxI1sEN9nz6CTnWENngTpQvWNEnEpSksLM6gBqZxyIXA 9bTI98cIYd9hWHHzyCFJ+FmdCvBiHHDaKv48d7ne3NW4lE5BR7mHnXJROioBx2Rght tqKdkAmd5Isiw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0F0426A2AB for ; Sun, 29 Mar 2026 09:02:07 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774796524; bh=pnFlT/hBZn4JH30NmuQoadxsquO6yrf2egFw0ZeNAqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k3+cuE/G3+LYC97GG+MEV/DGNxzzx3Vu4zPGjtdpZ6UrX1/asNG00dQ60FF9ZJz5+ ZEXWbNoNX8zrqwxsH/QtLDLlhrgM5V/5z4jifqJs9Z3p13vMXSuwPJ9JC59NadYLoX OzY9PrR/i5OVD+5R2ExAdkBBBr5lXOdeC4kRkP9m3d5I9993TvpkW/0BtH7Vdh67p/ iechQycbpfoyNUW4vi3iCg7me9w1qpK5/YWREBaxDGer4NzrLa3Pkt5ifmsCnCd9T4 TWCsn8UFSD+whUCC8SZN/NHcRjLOBj0IyxDqYKwm68S6d5yFKdDOh3Y3sZNyct/V5x Lb6kb8HveAeBQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EBA966A2AB; Sun, 29 Mar 2026 09:02:04 -0600 (MDT) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ziRJAn3XrHgC; Sun, 29 Mar 2026 09:02:04 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1774796518; bh=9yu24i8p8UbkkwSHdpp6UhEtszf5rd3MveD4PWcMtqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pta69JmPgFqtoHQPqkMl4q8oT0k96fgvOmuACr9UHQHq53pc6RiP3QgkugFkjlUH8 DEQhuGQoPaJMN5+di2rD9UmFn0ovCxeAxO85Uv23jaAoUo0LbM4EyJdaZArPNORb0Y osCvzUQMFjAaUDwRAaQB5YqS18F1fdL1q7gt8raEvNzeobOGTUG2aiKw61g3rx2ROK 84pHS7jvDy5jforjbaeg/3rx+V8ShvVcD7++hEbiNobtRACDrpzOlj7iGLEAyGb/BM upnqkvqeQ7UtFd1Xn1tQTD3BztJb0rKnTH1IxoLH7U7hJnkvYOsMnF531TVGcaSasW 4I6VMiTfCHiBg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 871A46A2CB; Sun, 29 Mar 2026 09:01:58 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sun, 29 Mar 2026 09:01:29 -0600 Message-ID: <20260329150140.4095446-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260329150140.4095446-1-sjg@u-boot.org> References: <20260329150140.4095446-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: KGFU2L2JGLZ5T64GWGC6X7MGMDVKQD5I X-Message-ID-Hash: KGFU2L2JGLZ5T64GWGC6X7MGMDVKQD5I X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/11] patman: Fix output ordering when running git send-email List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass When patman runs git send-email, stdout goes through a PTY filter while stderr goes directly to the terminal. Since git send-email writes prompts to stderr and email details to stdout, the prompts appear before the context they relate to (e.g. "Send this email?" appears before the email headers). Add a merge_stderr parameter to run_pipe() and use it for the send-email invocation. This redirects stderr to stdout so both streams go through the same PTY, preserving the correct output order. Signed-off-by: Simon Glass --- tools/u_boot_pylib/command.py | 10 ++++++++-- tools/u_boot_pylib/gitutil.py | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/u_boot_pylib/command.py b/tools/u_boot_pylib/command.py index 54a7ee8e672..c44bed6acc0 100644 --- a/tools/u_boot_pylib/command.py +++ b/tools/u_boot_pylib/command.py @@ -66,7 +66,8 @@ class CommandResult: def run_pipe(pipe_list, infile=None, outfile=None, capture=False, capture_stderr=False, oneline=False, raise_on_error=True, cwd=None, - binary=False, output_func=None, stdin_data=None, **kwargs): + binary=False, output_func=None, stdin_data=None, + merge_stderr=False, **kwargs): """ Perform a command pipeline, with optional input/output filenames. @@ -87,6 +88,9 @@ def run_pipe(pipe_list, infile=None, outfile=None, capture=False, output_func (function): Output function to call with each output fragment (if it returns True the function terminates) stdin_data (str or None): Data to send to the first command's stdin + merge_stderr (bool): True to redirect stderr to stdout so that both + streams are interleaved in order. Use this for interactive + processes where output ordering matters. **kwargs: Additional keyword arguments to cros_subprocess.Popen() Returns: CommandResult object @@ -123,7 +127,9 @@ def run_pipe(pipe_list, infile=None, outfile=None, capture=False, kwargs['stdout'] = cros_subprocess.PIPE elif outfile: kwargs['stdout'] = open(outfile, 'wb') - if capture_stderr: + if merge_stderr: + kwargs['stderr'] = cros_subprocess.STDOUT + elif capture_stderr: kwargs['stderr'] = cros_subprocess.PIPE try: diff --git a/tools/u_boot_pylib/gitutil.py b/tools/u_boot_pylib/gitutil.py index 22414d250a9..8e45727b47a 100644 --- a/tools/u_boot_pylib/gitutil.py +++ b/tools/u_boot_pylib/gitutil.py @@ -563,7 +563,7 @@ send --cc-cmd cc-fname" cover p1 p2', 0) result = command.run_pipe( [cmd], capture=True, output_func=echo_output, - raise_on_error=False, cwd=cwd) + raise_on_error=False, cwd=cwd, merge_stderr=True) num_sent = result.stdout.count('Result: ') cmd_str = ' '.join([f'"{x}"' if ' ' in x and '"' not in x else x for x in cmd])