2021-09-18 13:31:03 +03:00
|
|
|
#!/bin/sh
|
2021-09-18 19:23:28 +03:00
|
|
|
set -eu
|
2021-09-18 13:31:03 +03:00
|
|
|
|
2021-09-19 11:51:18 +03:00
|
|
|
FQ="$1"
|
|
|
|
shift
|
|
|
|
|
2021-09-18 13:31:03 +03:00
|
|
|
if which expect >/dev/null 2>&1; then
|
|
|
|
TEMPDIR=$(mktemp -d)
|
2021-09-19 11:51:18 +03:00
|
|
|
cp "$FQ" "${TEMPDIR}/fq"
|
2021-09-18 19:23:28 +03:00
|
|
|
PATH="${TEMPDIR}:${PATH}" expect "$1" >"${TEMPDIR}/fq.log" && FAIL=0 || FAIL=1
|
|
|
|
if [ $FAIL = "1" ]; then
|
2021-09-18 13:31:03 +03:00
|
|
|
cat "${TEMPDIR}/fq.log"
|
|
|
|
fi
|
|
|
|
rm -rf "${TEMPDIR}"
|
2021-09-18 19:23:28 +03:00
|
|
|
if [ $FAIL = "1" ]; then
|
2021-09-18 13:31:03 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-09-19 12:58:37 +03:00
|
|
|
echo "$0"
|
2021-09-18 13:31:03 +03:00
|
|
|
else
|
2021-09-19 12:58:37 +03:00
|
|
|
echo "$0: skip as expect is not installed"
|
2021-09-18 13:31:03 +03:00
|
|
|
fi
|