From patchwork Wed Feb 21 08:25:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mostafa Weshahy X-Patchwork-Id: 1901910 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=reo/q3i4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::73e; helo=mail-qk1-x73e.google.com; envelope-from=swupdate+bncbcakrkerbqinjz6wvydbubhx43diu@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-qk1-x73e.google.com (mail-qk1-x73e.google.com [IPv6:2607:f8b0:4864:20::73e]) (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 4TfqBc73rrz23d2 for ; Wed, 21 Feb 2024 19:27:04 +1100 (AEDT) Received: by mail-qk1-x73e.google.com with SMTP id af79cd13be357-78783a27ce8sf56859285a.0 for ; Wed, 21 Feb 2024 00:27:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708504020; cv=pass; d=google.com; s=arc-20160816; b=hpfcQ3xH3JCqZqbEfv7jRnLv+ZOooZS4oO4wuT35MqKDq6H6g7a3WgyxMJ9Z1JPd4k Hcdk3DMXiZNU+6zkz61oVVOdBZlDLs0vXnOMK1WB5whiW1s1UboxTyIt9M4mgMymuxja 1Cl+Iq8j7WTbs6OaNsGMVrnj6q4APJ/lPFUhklEGmmCSIaB1Wh4+JNMQhQAkrw4SEPG/ 88vBh0+a4umZokSEmW/mGMUXTMXBSZFF9fvIMrkpPHYqeFUn2F731murzIDpptC2rjih WHq+ALIfnqDwpwqjHeZ7zl+/6/PyCPLAbcy3BG0Av3FU4WRhNoF2L+PNsVOozz5G70xb HXfA== 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=v2kPsUGaQDqXVXqrfvQ6wbMr4Ovop9ehO9TRucNDbY0=; fh=lnZsyP8ZNFZBGpzPnNb0acDqVY52V8EjbSR3k6cPQ5o=; b=laShv+dwmQ/HxAEw2eAkJwmXuvaTQdDP/xuP0iJoSGVkRe7cu3k9yHi+4BLGI/9KwZ O6/awfqLSyj2H3Ast+hwMzeEfxqq/egN54bsi4iBPtjNmx5QA4yZt0Eg5l7YgwMPQuww l1UXncyCoYXIb2K9FP5xje///FTM89hWvdB/PcoGZB2zbs2JnHKORfFJi7Ifagxo3ppf l0ZAwHH8gwZagJZgJU+L71N7tVtrqhlKd9pf2EDPzzVJZweWPw3+eyW/sAlTWt0/1cu8 UBoYMQbJhU2u3ECa8bLK/LGjT7iEK3cq7XEjnENNyHRZlQ0hwQUkgUe9V0BTPl2p1TUw 4sOg==; darn=patchwork.ozlabs.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=n5Mqpa2f; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.132.40 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=1708504020; x=1709108820; 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=v2kPsUGaQDqXVXqrfvQ6wbMr4Ovop9ehO9TRucNDbY0=; b=reo/q3i43NeFS2uZS23lyj031RLIbEOW+cGLO/2qiqO9v4uTwcNqjliu6YELdq0hZk POvCPTALqZFo1XxDdj76i2qjD8y+O3o085wbNtvuMkzgnglrMAkNmsdZR01GwoLHZKe6 WHjnod70lyLdRLDkMFW+wGi9HadkOq++7p101wLePq4FOACtOxvzLhPedVtcngndDJSI 4HojAbwY366WNqQUPy4d5i1HXBC+XPh4BEBlygIRdENw1IhBaOURYTt5ETxXu1VkPODD OmYsxUSlc5O5qKSeVx6X7YHpOpSy/ATBXrDPnx+aA0W4jFwkIWVhQOqfs8ddc50RaROe qGug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708504020; x=1709108820; 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=v2kPsUGaQDqXVXqrfvQ6wbMr4Ovop9ehO9TRucNDbY0=; b=I9dl6S11uBh55Loqb7/c+gv/kpKSX8voDWJ17erSQxei7oCs+Ke39yQiNNj71Iqi7J zxPdYS821kzzVIv/1EZEM1OIghrNze87aJuu8TY+4V/0hAJldldyHWyiXQJy4eSb4bGb VMuDb3MLrSB5xVFA8I7THiJyMQGLzv4M/kvq3t1ACAnWAK58sGSk98UgiBaV/VB64TaM LzbcdhwsffSU/OEYvhiuh6ORA8zkBVUaTslP5uiM5lvyBYlTnsN1cbtGyt+C2hFgb16m uQGS3lLehoDqHVnBVqT9Nih84qkmTU1R90Seat/InZoULaPpBgdGFd+AsLYghT2+CV2A uo+w== X-Forwarded-Encrypted: i=2; AJvYcCU+RS6+VilaAsZMqYYQisbTwvMqf2TA2uTDNOxRT37W8mnHlONujoMBrWRMvNhRPoKbp0IPLDRPfBE2+70D2KkS+ERff/r08Xms4Dq0sQ== X-Gm-Message-State: AOJu0YwNnp5uadni+LFoiid2Y2KoF53Q3le42DF6wI2nVcTahjdxJ/Vy qMsWAlBmDcXsBbZuUYfJQH89iGuWkApiyNfsXlrb25ciYTn2ttWQ X-Google-Smtp-Source: AGHT+IFJ/cIsuYn1Upw2+9xx6oOizioHbiIWTvyilURQ05SUHbb1Z7GzPz0v6p7NptPYdTHEEIs8xQ== X-Received: by 2002:ad4:4ee4:0:b0:68f:2d89:e02 with SMTP id dv4-20020ad44ee4000000b0068f2d890e02mr23042879qvb.11.1708504020505; Wed, 21 Feb 2024 00:27:00 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:6214:519e:b0:68c:5c2d:cae9 with SMTP id kl30-20020a056214519e00b0068c5c2dcae9ls7531650qvb.2.-pod-prod-05-us; Wed, 21 Feb 2024 00:26:59 -0800 (PST) X-Received: by 2002:a1f:df42:0:b0:4ca:80c5:752e with SMTP id w63-20020a1fdf42000000b004ca80c5752emr8093024vkg.5.1708504019316; Wed, 21 Feb 2024 00:26:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1708504019; cv=none; d=google.com; s=arc-20160816; b=iew/AN0WCV0LlhF4a1VKPTEW1tAg6FER3GsKm3B6REekeY22tseTknR2Y/FwOaIych 0hoi7JDHtRQHJzcE5Myl6nlSVazMC7vVKt6XEQ5VcWveYj4me8LY5NkOvtB2w0YKtHAi qxoWdISfStparsCCyISK4r3v+0KZ5IluYh1kMHk1tVaFZW81nSlP0GqGvsVOZ3iOa+T3 OS2vmb/HJpc998/ljH9uHCY8PG15/P56eljh+FBJNuyZD5X/pZFZLGJHhmJncrhUQd/2 eQdE+sKWtqrv4dJGAtqEzAS7UWJSVKdVmIpArJyoWqWplxxCIzgQvlSP9HpMa/Bnhugy eKKQ== 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=W9x4dqyGkj3ImsLMs9Z4kJLsq53f7LIjwYp/vdLJOck=; fh=hiWkI7e5it9gsnQH/EqkGPLe0xbROEJ1tP6UuY6Ha9k=; b=sKnYoD0hj1dthGyqJ+MdauRnZvPy/QxStu4yfHcofk8g/VOdkBMeAZedwU7kkkdclL ESrYbS1Hbx890cyBiF3AdGRfPcL1JkPY+yapIb8/ZkuhE36ut+IthPmkpUH8ttLR9FdX 9NjT4mrTFLnEBSvv6KFabPXN0KcmnFd5tNj0RJJGXDZlGbahoPnX39NvwNszamEpZgb+ lEuS+VBp7V3hPXaZ6Tkz8ePI9A7FHz5eSEBGNPy9/FcNc7J/GKcC9MeGBqt+5Vh1jl6j mp74MosG66vWbhVtt4JCUYvWgvGvpEouXIjDstAJYoolss6imBfwnWNZhWRIjYCEwVwB 4E/Q==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@yahoo.com header.s=s2048 header.b=n5Mqpa2f; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.132.40 as permitted sender) smtp.mailfrom=mweshahy@yahoo.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=yahoo.com Received: from sonic306-1.consmr.mail.bf2.yahoo.com (sonic306-1.consmr.mail.bf2.yahoo.com. [74.6.132.40]) by gmr-mx.google.com with ESMTPS id fi13-20020a0561224d0d00b004c027d19fd3si388345vkb.5.2024.02.21.00.26.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 21 Feb 2024 00:26:59 -0800 (PST) Received-SPF: pass (google.com: domain of mweshahy@yahoo.com designates 74.6.132.40 as permitted sender) client-ip=74.6.132.40; X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1708504018; bh=ns8s8q8KGYkh6i6EXjOkIZ5zQyN8rDyEQmCgKtibSXl=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b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RUawXQCyU1n1Bg0D7ep 0obLjmSMn.N5WQP92gm7LXSMYDOB2FjRnfuZkBZ8LcuN3YizLlORwT_WvdfW4.ijZ3aEMBaRY7Kz iGOW9lnyDBSn1bRH.gZVwuEGrjrkMPY2iczU3DiA7dVfNQd8FAnEkv4Uz9Vx7yMqgyRS2X.n4PwJ U6cQ4JkQx9nu1VyePrUL2fQeCCeAGpGcbFbH8xzmbpxhmy9e8YJiq9YBWe9ciX6ITZv0cesQKa4O HzMBx5YimswMQvH0IkxmmIypn80BalabO2ybOoqHzs021SFHHXomi4Xr6MrruoTB3nNBKOQZhDa0 SOV4cvd0bFX3zLX9egXCb.ljaJUpwqB2D7prv5aoeuIL7hS4RqV8.Rne2u32Ss7zwKO1iQejqA.t dM9g8_D1kSYtPF0xOrEkcQyvDOVlYoFVSYHDpjcmBUqZfmbKwre_IjaHdCzYhXFiWQNiqTy2kurK j3WEan.Xa_N4ayczglHDwzMcwfBPC7s05bY.sdWI.pZHlJotb1D0DWMBPZyYQqaTGhVvPkWs9ACj JP705YJvVUw-- X-Sonic-MF: X-Sonic-ID: b2bacf21-6cf9-47a6-8bd4-d900fa3d5fad Received: from sonic.gate.mail.ne1.yahoo.com by sonic306.consmr.mail.bf2.yahoo.com with HTTP; Wed, 21 Feb 2024 08:26:58 +0000 Received: by hermes--production-ir2-7bc88bfc75-8kqvj (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9dfe4eb3f11b10792c125211796f6ebd; Wed, 21 Feb 2024 08:26:56 +0000 (UTC) X-Patchwork-Original-From: "'Mostafa Weshahy' via swupdate" From: Mostafa Weshahy To: swupdate@googlegroups.com Cc: Mostafa Weshahy Subject: [swupdate] [PATCH 1/1] swupdate-progress: multiline file redirected stdout progress Date: Wed, 21 Feb 2024 09:25:41 +0100 Message-Id: <20240221082541.12873-1-mweshahy@yahoo.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 References: <20240221082541.12873-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=n5Mqpa2f; spf=pass (google.com: domain of mweshahy@yahoo.com designates 74.6.132.40 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 --- tools/swupdate-progress.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletions(-) diff --git a/tools/swupdate-progress.c b/tools/swupdate-progress.c index 487e72b..6720b56 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); @@ -335,7 +338,7 @@ int main(int argc, char **argv) /* * Be sure that string in message are Null terminated */ - if (msg.infolen > 0) { + if (msg.infolen > 0 || redirected) { char *reboot_mode; int n, cause; @@ -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); }