#!/us/bin/env bash # # Copyright by The HDF Group. # Copyright by Akadio, Inc. # # This file is part of HDF5. The full HDF5 copyright notice, including # terms governing use, modification, and redistribution, is contained in # the COPYING file, which can be found at the root of the source code # distribution tree, or in https://www.hdfgroup.org/licenses. # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # # Tests for the vfd swmr feature. # catch_out_err_and_rc outbase command [arguments] # # Run `command` with any `arguments` provided. Redirect `command`'s # stderr and stdout to the file `outbase.out`. Record the result code # of `command` in `outbase.rc`. # catch_out_err_and_rc() { if [ $# -lt 2 ]; then echo "usage: catch_output_and_rc outbase command [arguments]" \ 1>&2 exit 1 fi outbase=$1 shift { "$@" < ${STDIN_PATH:-/dev/stdin} > ${STDOUT_PATH:-/dev/stdout} & echo $! > ${outbase}.pid wait $(cat ${outbase}.pid) echo $? > ${outbase}.rc } 2>&1 | tee ${outbase}.out } #catch_out_err_and_rc xxlsxx ls smiles & #wait #echo result=$(cat xxlsxx.rc) #exit 0