mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00

* clean it up * Update .travis.yml * Update .travis.yml * update * fix example * suppress * timeout * print periodic progress * Update suppress_output * Update run_silent.sh * Update suppress_output * Update suppress_output * manually do timeout * sleep 300 * fix test * Update run_silent.sh * Update suppress_output * Update .travis.yml
34 lines
629 B
Bash
Executable file
34 lines
629 B
Bash
Executable file
#!/bin/bash
|
|
# Run a command, suppressing output unless it hangs or crashes.
|
|
|
|
TMPFILE=`mktemp`
|
|
COMMAND="$@"
|
|
PID=$$
|
|
|
|
# Print output to avoid travis killing us
|
|
watchdog() {
|
|
for i in `seq 5 5 120`; do
|
|
sleep 300
|
|
echo "This command has been running for more than $i minutes..."
|
|
done
|
|
echo "Command timed out after 2h, dumping logs:"
|
|
cat $TMPFILE
|
|
echo "TIMED OUT"
|
|
kill -SIGKILL $PID
|
|
}
|
|
|
|
watchdog & 2>/dev/null
|
|
WATCHDOG_PID=$!
|
|
|
|
time $COMMAND >$TMPFILE 2>&1
|
|
|
|
CODE=$?
|
|
if [ $CODE != 0 ]; then
|
|
cat $TMPFILE
|
|
echo "FAILED $CODE"
|
|
kill $WATCHDOG_PID
|
|
exit $CODE
|
|
fi
|
|
|
|
kill $WATCHDOG_PID
|
|
exit 0
|