common/bin/logger.sh
changeset 12801 948f8ad66ee7
parent 12258 6ec26f6cc53e
child 14111 2a82ecb35fc7
equal deleted inserted replaced
12796:5c5a64ec0839 12801:948f8ad66ee7
    35 # Propagate the result code from acommand so that
    35 # Propagate the result code from acommand so that
    36 # ./logger.sh exits with the same result code.
    36 # ./logger.sh exits with the same result code.
    37 
    37 
    38 # Create a temporary directory to store the result code from
    38 # Create a temporary directory to store the result code from
    39 # the wrapped command.
    39 # the wrapped command.
    40 RCDIR=`mktemp -d tmp.XXXXXX` || exit $?
    40 RCDIR=`mktemp -dt jdk-build-logger.tmp.XXXXXX` || exit $?
    41 trap "rm -rf '$RCDIR'" EXIT
    41 trap "rm -rf \"$RCDIR\"" EXIT
    42 LOGFILE=$1
    42 LOGFILE=$1
    43 shift
    43 shift
    44 (exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > $RCDIR/rc) | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
    44 (exec 3>&1 ; ("$@" 2>&1 1>&3; echo $? > "$RCDIR/rc") | tee -a $LOGFILE 1>&2 ; exec 3>&-) | tee -a $LOGFILE
    45 exit `cat $RCDIR/rc`
    45 exit `cat "$RCDIR/rc"`
    46