mirror of
https://github.com/JHUAPL/PINE.git
synced 2026-01-08 22:27:53 -05:00
Including: 1. Generated python documentat in docs/. 2. Starting a new python client in client/. 3. Moving testing data to test/. 4. The addition of Cypress UI tests and pytest tests in test/. 5. A number of bug fixes and improvements.
34 lines
626 B
Bash
Executable File
34 lines
626 B
Bash
Executable File
#!/bin/bash
|
|
# (C) 2019 The Johns Hopkins University Applied Physics Laboratory LLC.
|
|
|
|
if [[ $# -lt 3 ]]; then
|
|
echo "Usage: $0 <stdout prefix> <stderr prefix> <command> [<arg>...]"
|
|
exit 1
|
|
fi
|
|
|
|
STDOUT_PREFIX="$1"
|
|
STDERR_PREFIX="$2"
|
|
shift 2
|
|
COMMAND=$@
|
|
|
|
prepend() {
|
|
local line
|
|
while read line; do
|
|
printf '%b: %s\n' "$1" "$line"
|
|
done
|
|
}
|
|
|
|
STDOUT=$(mktemp -u)
|
|
STDERR=$(mktemp -u)
|
|
mkfifo "$STDOUT" "$STDERR"
|
|
trap "rm -f \"$STDOUT\" \"$STDERR\"" EXIT
|
|
|
|
prepend "${STDOUT_PREFIX}" < "$STDOUT" >&1 &
|
|
prepend "${STDERR_PREFIX}" < "$STDERR" >&2 &
|
|
eval "$COMMAND" 1> "$STDOUT" 2> "$STDERR"
|
|
EXIT=$?
|
|
|
|
wait
|
|
exit $EXIT
|
|
|