summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2017-06-14 16:00:17 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2017-06-14 17:37:03 +0200
commitbf1a5b588e4c1b0ac7dbfd52d4acb4c0d1b81539 (patch)
tree0779c9926fc74811fa34433bda668be06d46176a /scripts
parent320e3d483880c170b9bb928783f497833e194258 (diff)
downloadptxdist-bf1a5b588e4c1b0ac7dbfd52d4acb4c0d1b81539.tar.gz
ptxdist-bf1a5b588e4c1b0ac7dbfd52d4acb4c0d1b81539.tar.xz
ptxd_make_log: improve output handling
Make it possible to use PTXDIST_FD_LOGERR to bypass output redirection. Ensure that ptxd_bailout() output is always logged and printed to the console. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/libptxdist.sh9
1 files changed, 8 insertions, 1 deletions
diff --git a/scripts/libptxdist.sh b/scripts/libptxdist.sh
index a950c32a0..c0641e3de 100644
--- a/scripts/libptxdist.sh
+++ b/scripts/libptxdist.sh
@@ -390,6 +390,13 @@ ptxd_make_log() {(
# stderr and logfile
exec {logerr}> >(tee -a "${PTX_LOGFILE}" >&2)
+ export PTXDIST_FD_LOG_STDOUT=${logout}
+ export PTXDIST_FD_LOG_STDERR=${logerr}
+ if [ ${PTXDIST_FD_LOGERR} = 1 ]; then
+ PTXDIST_FD_LOGERR=${PTXDIST_FD_LOG_STDOUT}
+ else
+ PTXDIST_FD_LOGERR=${PTXDIST_FD_LOG_STDERR}
+ fi
ptxd_make "${@}" 1>&${logout} 2>&${logerr}
)}
@@ -736,7 +743,7 @@ ptxd_debug "Debugging is enabled - Turn off with PTX_DEBUG=false"
# ${PTXDIST_LOG_PROMPT}: to be printed before message
#
ptxd_bailout() {
- echo "${PTXDIST_LOG_PROMPT}error: $1" >&${PTXDIST_FD_STDERR}
+ echo "${PTXDIST_LOG_PROMPT}error: $1" >&${PTXDIST_FD_LOG_STDERR}
exit ${2:-1}
}
export -f ptxd_bailout