wait-on-file: properly wait on any files and symlink
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 05 Apr 2022 04:43:34 +0200
changeset 49230 a68b37524d50
parent 49229 883be4c74d54
child 49231 575f3dedb69a
wait-on-file: properly wait on any files and symlink This make the utility more useful, for example to wait on a lock file. We also add an explicit -L check since the lock are "weird" symlink. Differential Revision: https://phab.mercurial-scm.org/D12617
tests/testlib/wait-on-file
--- a/tests/testlib/wait-on-file	Tue Apr 05 04:41:09 2022 +0200
+++ b/tests/testlib/wait-on-file	Tue Apr 05 04:43:34 2022 +0200
@@ -29,7 +29,7 @@
     touch "$create"
     create=""
 fi
-while [ "$timer" -gt 0 ] && [ ! -f "$wait_on" ]; do
+while [ "$timer" -gt 0 ] && !([ -e "$wait_on" ] || [ -L "$wait_on" ]) ; do
     timer=$(( $timer - 1))
     sleep 0.02
 done