Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Corrected defects in iotimeout script.

  • Loading branch information...
commit bb427476e3dcdb99e8181b9ca7a40d4458137eec 1 parent cdeb30c
AutoBuild authored
Showing with 10 additions and 6 deletions.
  1. +10 −6 iotimeout
View
16 iotimeout
@@ -1,28 +1,32 @@
# timelimit watches standard out for a delay longer than the timeout w/o any output.
# Example:
# make clean test | timeout 300
-procid=$$
timelimit=$1
touch tmp.out # Set initial time in case never get any output
-while true
-do
+(
+ while true
+ do
+ if [ ! -f tmp.out ]; then break; fi
lastline=$(date +%s -r tmp.out)
currtime=$(date +%s)
(( diff = currtime - lastline ))
if [ $diff -gt 10 ]
then
- echo "Over $diff seconds w/o response."
+ echo "More than $diff seconds w/o any response."
fi
if [ $diff -gt $timelimit ]
then
echo "Exceeded maximim timout of ${timelimit} seconds w/o response."
kill -9 0
- exit 1
fi
sleep 10
-done &
+ done
+) &
while read -r line
do
echo "$line"
touch tmp.out
done
+rm tmp.out
+wait
+echo "iotimeout finished."
Please sign in to comment.
Something went wrong with that request. Please try again.