From patchwork Wed Feb 21 17:04:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mostafa Weshahy X-Patchwork-Id: 1902239 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=baJ6eseU; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::840; helo=mail-qt1-x840.google.com; envelope-from=swupdate+bncbcakrkerbqimdwwyvydbubdrfvjvi@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-qt1-x840.google.com (mail-qt1-x840.google.com [IPv6:2607:f8b0:4864:20::840]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Tg2hP5Vpzz20RF for ; Thu, 22 Feb 2024 04:05:08 +1100 (AEDT) Received: by mail-qt1-x840.google.com with SMTP id d75a77b69052e-42c7ce60175sf86622601cf.1 for ; Wed, 21 Feb 2024 09:05:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708535105; cv=pass; d=google.com; s=arc-20160816; b=lr8/lrBbMNj+NZ/9ZVTHs7xk20n47VxYY1Yb9+tlQ1y0mOEETiIXkGcF3NgwkQIV24 jtlaaP3Fk8/GrPI3hHdDR9dfHVx8afaDbJWX8e5+MLeBpu2od6IE5KHGr5TsVtDXCUm5 xFMHx69qodi6hDFuD555JCPAi+NESgE0DxGIHs00aiO0Y8N5IXtsfGzIlXJvW7KBbWQk bgHyI5G+VpiqDbXI6oPGm7ayEtL6e4skergtSO7XFcN9wqKzMaxDJ8Vz8DFlX1OrpJQx kQZQsmoP8snVbdtQjFzhpHXR9zhx1VnmDD7bmDx2u91mXRSdoJfwdVpoU1tFJDGI/44P 3T5w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to:references:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=ky3HNLHxLyHpDKTGcA4KPTe0Pb6drOufu6Tgyt20N8I=; fh=Y/Hsi5jUFxNzTs1Jc8Hg1qOVReA1aWpfw6r54OxD78k=; b=EGNnX3Cebh7s0KhEkfea6txUSeKyUKcpSORO4gsjPmzwdzYn7VJbmDM5Wjx1u27OBA mpqYisaVU+Hxfw3OQfWqMB1FvtGhWSgLCtRDWhAYTPm0NPDfj6D0us/hkQhYaVNmbf3R YsKwnUfJ+eU6XIKy7QRZtghGI2+KoLHGIJ0feU4wcm/wts+T00F+928djYqlGDL7f8eK FHRAL14HvcmtkFnpkUEvrdYswLGnCV8ve/UZQkPGfVImsX6HviF8ICVMo+RjYxqqSO9u Jf57UxgJf4voLL5rt8DKFROVbXm8UlzqCZA6ws+2LudMZCW8gUA8K+QIPMe4WsPuK4J1 F+jg==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=D7XJuo8q; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.131.124 as permitted sender) smtp.mailfrom=mweshahy@yahoo.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1708535105; x=1709139905; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:references :mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=ky3HNLHxLyHpDKTGcA4KPTe0Pb6drOufu6Tgyt20N8I=; b=baJ6eseU1DoZCS4qMZbcxTCPSwRhhUf6tbDhCO2i7O5zr/sLLceY17jgS1mpBXa4To EQOlQVY5giJsFde4rb74e91a53qpiwLHL7j3YXpqDQoKUVOQBHS+QX14DtBTyFZMPwTO +LK/6B+l4BEXgTlb4rpR+lH4PxHpw3dOXm5cs1CONev0tfnUS5FEbQQUdKo42mT7ASQl wN6p/4u4THSpuDvLvCdQchbIo6CklL1clRCCFV/YUNk9Hl3YutvFeyhHcEEqkip0j++I VXn1mh2PkDL6GKpr2kAj37mEP0NiKThuVzL5sVsMxflBq470RyBAm+ZyfxwpiVo9Bjho 7QWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708535105; x=1709139905; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence:reply-to :x-original-authentication-results:x-original-sender:references :mime-version:message-id:date:subject:cc:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ky3HNLHxLyHpDKTGcA4KPTe0Pb6drOufu6Tgyt20N8I=; b=kkhnpgcEPd35K+XOOkLbERzvxHonMsfLCXCMrT9AL9zgoReaXCUJnRHueUWOZXAmuB Gx5NsLsf7KEdEE0DLOkgWy5UOBtq1YYgiLavSDPjaqT70YZfrOpd7gwSsgvfrFGUKdbv hWtWJNwn48YEeK01gmTevEZv9kHEq0MLcKgeLGMGGFq8VjcbNYoDLByioLi5xyk/jlDR ZdGwalmgh88GAcb5XrULXBP4Bp7k4E4R02S+7UuExct718jrmiDyH4+yS8Eikoh9fm+Q pf7CM5j20yYSr4/yQXbdHFYv6oj1stgGH32J5rR17E3ri527uuRYcaTJrf3e8LAVv51g /ihg== X-Forwarded-Encrypted: i=2; AJvYcCWu4SNwMoqYVzGJRsGUFbQLGrRA+VR+P6Dr0r9hhOKQKn3QYYdhDFsCv3cCdwlQPw8Wu6TR7TtRUdQ8Xw55ZGH1tL79953ytKEVneMWhA== X-Gm-Message-State: AOJu0YwulW5QWaDp7GCpWgwMHzFdwBZHtx5AFnQpIJJQ0NF9IXRZnEhH CSDq+PEPdXShOS7TOqCTqGoeAiwEhNfdO0RrviNYI1RjMqDJ31vi X-Google-Smtp-Source: AGHT+IHFH0oLO1BtVLxExdeIqCuCjyI0Gglw9paUArWUxXeWEvNnbh1cBKs89pqTKLl96CApHZNdBA== X-Received: by 2002:ac8:4e4a:0:b0:42e:15d0:c75e with SMTP id e10-20020ac84e4a000000b0042e15d0c75emr9469573qtw.30.1708535105398; Wed, 21 Feb 2024 09:05:05 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac8:5a88:0:b0:42e:1424:c70a with SMTP id c8-20020ac85a88000000b0042e1424c70als4683725qtc.0.-pod-prod-07-us; Wed, 21 Feb 2024 09:05:04 -0800 (PST) X-Received: by 2002:a05:622a:1a24:b0:42e:284:5f73 with SMTP id f36-20020a05622a1a2400b0042e02845f73mr13413424qtb.15.1708535104181; Wed, 21 Feb 2024 09:05:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708535104; cv=none; d=google.com; s=arc-20160816; b=VJtAxw48qpjNVk+K5C/+7Zp1jY2ThKi7wUnLwjB+U1hEYySm+nTr9o5JTK4YomdNHy 7oepy6r4CMqdqUGdH7chjNTbqaFeDqKNfTD6P8VfFpm1wly8UQ6p96J3xNLzqZx2CA+P sEvQt+0FkDnA1CkH5hWXpzWO0oC9VZOnX6CtAtZj7F5D7AjVfObXEwsterT+gA0XXF+s FiN/tTqpzTOChLti2UoQqxJfjbsI4TpQ5gDEnpE6lEpenobqCvn6fZsicEhnV1pZnUZj EBzN9JTzddhozRtgpJIv31FyoFWE8KGc8YKVIpn1FkiUgjiMAH8Bz1FaQoxVdtf67YU5 nxAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:content-transfer-encoding:mime-version:message-id:date :subject:cc:to:from:dkim-signature; bh=PiDMmM1TXeL1F/aJzKCzfcECAxMr3XvfrjbQAJtBuCo=; fh=hiWkI7e5it9gsnQH/EqkGPLe0xbROEJ1tP6UuY6Ha9k=; b=c3vBLFgFW+2V+OsuxjVRDqr6Xx75py+YW41NXmTgIz+CdGsD3btG3Ch3tlm7k1vAcd VR2owfa04qGuOBUJWwwIGtpUKZRqtbvcj8AVR17CukmNDLkR05kQzOvAMpt0cGI9jGPq dexO78TGN7UlMLOAm+8/jfYUZmj36fguMH/lHafaiNiGI2PIgi7jphW0ny28YL1me+YH 82d8gAwNKclVuAuuWZio0P6sE6BTPaf+6Ru07Ik68p/CRNsJQrsE01Z5LxiMLDp6ufsS lB4Noq6baJtRJwyju5+dXxeVFV4Cz4n/8hZ3ETN+ASOao7KnIHkM3Pp3xT0oEuTuBIdf NDpg==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=D7XJuo8q; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.131.124 as permitted sender) smtp.mailfrom=mweshahy@yahoo.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com Received: from sonic311-14.consmr.mail.bf2.yahoo.com (sonic311-14.consmr.mail.bf2.yahoo.com. [74.6.131.124]) by gmr-mx.google.com with ESMTPS id g1-20020ac85d41000000b0042e082ee1f5si545297qtx.0.2024.02.21.09.05.04 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Feb 2024 09:05:04 -0800 (PST) Received-SPF: pass (google.com: domain of mweshahy@yahoo.com designates 74.6.131.124 as permitted sender) client-ip=74.6.131.124; X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1708535103; bh=NJjT/Uyc91RIAcew38iEVzvm9ZR7pTxxmzQ6I8FIVEl=; h=X-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zoG25Dd2hn4BBHDv4R9yOh3dj6hJie1FQRj_.h17oKBf7o7734rB1jR1D6 IxbofSfZrynYGO26PXQrKNTAV3a6fqgMHV8cIbDZoyCKTxKBcAidVKJN0ygcuNr7XDJiumtN.9Wi dFDs4tL5pkdcUQerzLEU.0VHAOaTm9lmYJF6jN70C.jIHrusUkMX8301mc9BVjhEh_RUlWtbI__S ZLuEy5DY_JB6mF1nBEJmm1e8SZIMFvmVzClU3GQ6jPTuXVfRpalZs1038sdWPAVsOZJsyY4wmpA_ m3hYFiomBOx4yLCNF6oc.Odb5A8WQBry2Ki5Xd85hNXCJqcxtHDcFPyZ46WDIxytvLfY_4EGUPgr 3ZfGYW33TAatURWmqQluu4bcY.T_9Azgcz9kDeFuHFANoVGjJOgBh8SUm9IUbBve9_kIgZp5Csqx kHWJaXs6BnoiB7MAIwAbVYk9TrtVAvbfq46ESPdMGSZSpcLxo7AE7K24T_oPQiX3le4bnM_MxpzP orh3kmlWW85SzMsEnS5C4DwTRM5iK4ZqfE7T228L28ofsoKFyY_JSNl9Fw9v7Dl5sO78e8.fooI9 HZMbeVA_QdCb49w4- X-Sonic-MF: X-Sonic-ID: b9d4ecfb-401a-4fd6-93a6-3eef6ca1bf25 Received: from sonic.gate.mail.ne1.yahoo.com by sonic311.consmr.mail.bf2.yahoo.com with HTTP; Wed, 21 Feb 2024 17:05:03 +0000 Received: by hermes--production-ir2-7bc88bfc75-2gzvg (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 87b44e2689f7664bed5f974d3eba9e42; Wed, 21 Feb 2024 17:04:53 +0000 (UTC) X-Patchwork-Original-From: "'Mostafa Weshahy' via swupdate" From: Mostafa Weshahy To: swupdate@googlegroups.com Cc: Mostafa Weshahy Subject: [swupdate] [PATCH 2/2] swupdate-progress: multiline file redirected stdout progress Date: Wed, 21 Feb 2024 18:04:26 +0100 Message-Id: <20240221170426.18518-1-mweshahy@yahoo.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 References: <20240221170426.18518-1-mweshahy.ref@yahoo.com> X-Original-Sender: mweshahy@yahoo.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=D7XJuo8q; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.131.124 as permitted sender) smtp.mailfrom=mweshahy@yahoo.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com X-Original-From: Mostafa Weshahy Reply-To: Mostafa Weshahy Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , This commit adds a check to swupdate-progress to multiline the progress bar if stdout is redirected to a file. This is done to prevent having very long line in the stdout redirected file. Signed-off-by: Mostafa Weshahy Reviewed-by: Stefano Babic --- tools/swupdate-progress.c | 5 +++++ 1 file changed, 5 insertions(+), 0 deletions(-) diff --git a/tools/swupdate-progress.c b/tools/swupdate-progress.c index 487e72b..584910d 100644 --- a/tools/swupdate-progress.c +++ b/tools/swupdate-progress.c @@ -233,6 +233,7 @@ int main(int argc, char **argv) char *script = NULL; bool wait_update = true; bool disable_reboot = false; + bool redirected = false; /* Process options with getopt */ while ((c = getopt_long(argc, argv, "cwprhs:e:q", @@ -280,6 +281,8 @@ int main(int argc, char **argv) snprintf(psplash_pipe_path, sizeof(psplash_pipe_path), "%s/psplash_fifo", rundir); } connfd = -1; + redirected = !isatty(fileno(stdout)); + while (1) { if (connfd < 0) { connfd = progress_ipc_connect(opt_w); @@ -385,6 +388,8 @@ int main(int argc, char **argv) bar, msg.cur_step, msg.nsteps, msg.cur_percent, msg.cur_image, msg.dwl_percent, msg.dwl_bytes); + if (redirected) + fprintf(stdout, "\n"); fflush(stdout); }