From: Jim Meyering Date: Sun, 6 Sep 2009 18:00:14 +0000 (+0200) Subject: tests: tail-2/flush-initial: correct race avoidance code X-Git-Tag: v7.6~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=15f26e296b4948edc6c7d33fc1caa6cb50999364;p=thirdparty%2Fcoreutils.git tests: tail-2/flush-initial: correct race avoidance code * tests/tail-2/flush-initial: Wait for the file to be nonempty, not for the process. Based on a suggestion from Pádraig Brady. --- diff --git a/tests/tail-2/flush-initial b/tests/tail-2/flush-initial index 2deff84f37..515b29d8b9 100755 --- a/tests/tail-2/flush-initial +++ b/tests/tail-2/flush-initial @@ -28,9 +28,10 @@ echo line > in || fail=1 stdbuf --output=1K tail -f in > out & tail_pid=$! -# Wait for the backgrounded `tail' to start. -while :; do - env kill -0 $tail_pid && break +# Wait for 1 second for the file to be flushed. +for i in $(seq 10); do + test -s out && break + echo sleep .1s sleep .1 done