blob: 8fc526a26e3d3cbd2efe9fbaf7a3bfb086f4fe57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
#!/us/bin/env bash
#
# 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
|