summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-09-06 20:00:14 +0200
committerJim Meyering <meyering@redhat.com>2009-09-06 20:00:34 +0200
commit15f26e296b4948edc6c7d33fc1caa6cb50999364 (patch)
treef272e199aad9d502fa8e184eebf074de28df32c0
parent467cc9bb4395da8de01208253d7d861c72f2a428 (diff)
downloadcoreutils-15f26e296b4948edc6c7d33fc1caa6cb50999364.tar.xz
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.
-rwxr-xr-xtests/tail-2/flush-initial7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/tail-2/flush-initial b/tests/tail-2/flush-initial
index 2deff84f3..515b29d8b 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