Patchwork D12617: wait-on-file: properly wait on any file and symlink

login
register
mail settings
Submitter phabricator
Date May 6, 2022, 8:38 a.m.
Message ID <differential-rev-PHID-DREV-ipobfmlf2txokevvtljt-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/50968/
State New
Headers show

Comments

phabricator - May 6, 2022, 8:38 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This make the utility more useful, for example to wait on a lock file.
  We also an explicit -L check since the lock are "weird" symlink.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D12617

AFFECTED FILES
  tests/testlib/wait-on-file

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/tests/testlib/wait-on-file b/tests/testlib/wait-on-file
--- a/tests/testlib/wait-on-file
+++ b/tests/testlib/wait-on-file
@@ -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