Skip to content

Commit

Permalink
t/t1002-kvs-cmd.t: use two separate loops, don't use file descriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
chu11 committed Jul 20, 2017
1 parent 2bfee8b commit a4a15e7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions t/t1002-kvs-cmd.t
Original file line number Diff line number Diff line change
Expand Up @@ -565,19 +565,28 @@ test_expect_success 'kvs: watch a dir, prefix path converted into a key' '
# expected output. This function will re-order the output in each
# appropriate section (i.e. between ====================== lines)
sort_watch_output() {
rm -f tmp_watch_file
rm -f watch_out_sorted
while read -u 10 line
num=0
rm -f tmp_watch_file_$num

while read line
do
if [ "$line" == "======================" ]
then
cat tmp_watch_file | sort >> watch_out_sorted
echo "======================" >> watch_out_sorted
rm -f tmp_watch_file
num=$((num + 1))
rm -f tmp_watch_file_$num
else
echo "$line" >> tmp_watch_file
echo "$line" >> tmp_watch_file_$num
fi
done 10<watch_out
done < watch_out

rm -f watch_out_sorted
num=$((num - 1))
for i in `seq 0 $num`
do
cat tmp_watch_file_${i} | sort >> watch_out_sorted
echo "======================" >> watch_out_sorted
done

return 0
}

Expand Down

0 comments on commit a4a15e7

Please sign in to comment.