From patchwork Sat Jan 3 01:18:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1195 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=1767403168; bh=IynqD5f/SepzYFOPsVKe984qMZHyQTH7cQSx8KEdFUM=; 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=ajuCQywI4WOWtFjhV21O3sfrqn9Pz80Z9K2G+73FGrKu39j2gVAjqG3/kSfZGEyR0 SV15kt3ir3df1htJTP/gVF3qYf5d2ptQWWUkFKxIfaObsHPAv8YdHDEfDRKeWzX7TS GFkhA2NjefQ7KbqsCdKZIz/9HLLRH2malCAP2qbr4tp6sGSADie+0L76X1jC9pGUN1 40mdRJWrgRJhyFOQF/IHEX/xm0eQ4NJxGPoYcezlaN8kS0NCXpZlDiT7M3dTsuN5mK qcIUBb+e1AStvzlIauTJbxTU2rtmd0+dSYbS0CVW+LS2cixbBYi3135z9GavFSITlG f36PYab8gw0Sg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3360D69034 for ; Fri, 2 Jan 2026 18:19:28 -0700 (MST) 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 WvPBuuN1prTl for ; Fri, 2 Jan 2026 18:19:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767403168; bh=IynqD5f/SepzYFOPsVKe984qMZHyQTH7cQSx8KEdFUM=; 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=ajuCQywI4WOWtFjhV21O3sfrqn9Pz80Z9K2G+73FGrKu39j2gVAjqG3/kSfZGEyR0 SV15kt3ir3df1htJTP/gVF3qYf5d2ptQWWUkFKxIfaObsHPAv8YdHDEfDRKeWzX7TS GFkhA2NjefQ7KbqsCdKZIz/9HLLRH2malCAP2qbr4tp6sGSADie+0L76X1jC9pGUN1 40mdRJWrgRJhyFOQF/IHEX/xm0eQ4NJxGPoYcezlaN8kS0NCXpZlDiT7M3dTsuN5mK qcIUBb+e1AStvzlIauTJbxTU2rtmd0+dSYbS0CVW+LS2cixbBYi3135z9GavFSITlG f36PYab8gw0Sg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 235996904D for ; Fri, 2 Jan 2026 18:19:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767403166; bh=/EO18Qh//skRRcAvs1y/bq3CAsIYNMCmcLHYoACTFXg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=awL+fGvVQhdHEZNgm+HXnxs8sfGpAzVEKljnFe1QsM6kmJpriLQyPueH2eXlbEr1N HmA8JG5Fp5mJ5jlhwGPtY6DobXnlDPZMo5mc0M4JhbCS8yLu/samB33ZrgRJl3GKiC lx5JiQbKvKy2g34Qgf1OHKSKtlB/5EGEA3k63HlnHjvy6BiY3f5+TCOwD3HRA/j2Yy f++0qV/EUGd+A5nZk9ZDf05oEZnrIDD5MvDbWZi00Mojhn1vSlD3xweXJefFkp0/6q LTRGmXxYEgxax/EzZb0osoZo5r3x1g0qItQ2dumLXFcF0hbdS+DlbxCWL9uWnP2Pxg nj/Q22huhu1Kw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 669F968FAF; Fri, 2 Jan 2026 18:19:26 -0700 (MST) 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 dNnxPYvDaYf0; Fri, 2 Jan 2026 18:19:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767403162; bh=N6z6cypwDRijyqRDHb1/AjI2swMxMl+xWPAcuH39Tuw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uLwW3q2aU0TuS7aysBrw/Pjgewz4wPrSW5EcE7KlbZTF8PUXvLG2NcDr6g9XxMUlC 4+YNJUOVnVx/mm6mnNDYZjpnmK7giGNCGY0qXqTGsc0C/wgPNdbEtSiYYzPdVrNwjK YzwszCekjvBSUgquPDGr26hkCKvZylcNRFkdyBO8ZUMOaXNSjZRlov2S5Jry+aQvzM BdmLEld5pwPrvXmcXJUUybZetBi791Ur+iP7qBmkzjOUsXzoEBnrgvkgBOdAKJq2d/ TPRlCnhS+u5alqRMrX3Z4v8ILzsqbkkQ0LH3EtoqHZbWuSNuzlZzyoNGInDxI7BAnj AlkXsPdDyTiKQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2E54968F5F; Fri, 2 Jan 2026 18:19:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 2 Jan 2026 18:18:37 -0700 Message-ID: <20260103011908.149445-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260103011908.149445-1-sjg@u-boot.org> References: <20260103011908.149445-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 2B6JEV2IRB3H2WAL6SILMOTSYIO3MOLO X-Message-ID-Hash: 2B6JEV2IRB3H2WAL6SILMOTSYIO3MOLO 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/24] u_boot_pylib: command: Convert output before raising exception 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 Call to_output() before raising CommandExc so that callers catching the exception get string output rather than bytes. This avoids the need for callers to handle bytes decoding themselves. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/u_boot_pylib/command.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/u_boot_pylib/command.py b/tools/u_boot_pylib/command.py index cb7ebf49ce5..6b3f9fe59bf 100644 --- a/tools/u_boot_pylib/command.py +++ b/tools/u_boot_pylib/command.py @@ -136,9 +136,10 @@ def run_pipe(pipe_list, infile=None, outfile=None, capture=False, if result.stdout and oneline: result.output = result.stdout.rstrip(b'\r\n') result.return_code = last_pipe.wait() + result = result.to_output(binary) if raise_on_error and result.return_code: raise CommandExc(f"Error running '{user_pipestr}'", result) - return result.to_output(binary) + return result def output(*cmd, **kwargs):