From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Wed, 04 Aug 2021 16:24:20 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mBHoi-0000bo-HJ for lore@lore.pengutronix.de; Wed, 04 Aug 2021 16:24:20 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1mBHoi-0007cH-06; Wed, 04 Aug 2021 16:24:20 +0200 Received: from dude.hi.pengutronix.de ([2001:67c:670:100:1d::7]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mBHo1-0007b9-Dw; Wed, 04 Aug 2021 16:23:37 +0200 Received: from rhi by dude.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1mBHo1-000082-5g; Wed, 04 Aug 2021 16:23:37 +0200 From: Roland Hieber To: ptxdist@pengutronix.de Date: Wed, 4 Aug 2021 16:23:27 +0200 Message-Id: <20210804142330.32739-2-rhi@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210804142330.32739-1-rhi@pengutronix.de> References: <20210804142330.32739-1-rhi@pengutronix.de> MIME-Version: 1.0 Mail-Followup-To: Roland Hieber , ptxdist@pengutronix.de Subject: [ptxdist] [PATCH v1 2/5] libptxdist: introduce ptxd_exec_silent_stderr X-BeenThere: ptxdist@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Cc: Roland Hieber Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "ptxdist" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: ptxdist-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Some programs print stuff to stderr that are not errors and are therefore not relevant to the usual build runs (e.g. openssl when loading the PKCS#11 libraries), but they may still be useful for debugging. When called with ptxd_exec_silent_stderr, stderr won't make it to the terminal except with 'ptxdist -v', but the messages are still available in the logfile. Signed-off-by: Roland Hieber --- scripts/libptxdist.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh index ee0ba39d3ea3..bb508798cb6f 100644 --- a/scripts/libptxdist.sh +++ b/scripts/libptxdist.sh @@ -776,6 +776,24 @@ ptxd_exec() { } export -f ptxd_exec +# +# execute command with silenced stderr, except when verbose building is enabled. +# the stderr output of the command will always be written to the logfile. +# +ptxd_exec_silent_stderr() { + exec 8>&2 + if [ "${PTXDIST_VERBOSE}" == "1" ]; then + : + elif [ -n "${PTXDIST_FD_LOGFILE}" ]; then + exec 2>&9 + else + exec 2>/dev/null + fi + "${@}" + exec 2>&8 8>&- +} +export -f ptxd_exec_silent_stderr + # # check if a previously executed pipe returned an error # -- 2.30.2 _______________________________________________ ptxdist mailing list ptxdist@pengutronix.de To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de