1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-26 01:37:20 +00:00

Simplify wait_for_mount()

This commit is contained in:
Jonas Borgström 2013-07-26 13:23:33 +02:00
parent 99f64dfe1d
commit beed6b368b

View file

@ -58,10 +58,9 @@ def _assert_dirs_equal_cmp(self, diff, fuse=False):
def wait_for_mount(self, path, timeout=5): def wait_for_mount(self, path, timeout=5):
"""Wait until a filesystem is mounted on `path` """Wait until a filesystem is mounted on `path`
""" """
parent_dev = os.stat(os.path.dirname(path)).st_dev
timeout += time.time() timeout += time.time()
while timeout > time.time(): while timeout > time.time():
if os.stat(path).st_dev != parent_dev: if os.path.ismount(path):
return return
time.sleep(.1) time.sleep(.1)
raise Exception('wait_for_mount(%s) timeout' % path) raise Exception('wait_for_mount(%s) timeout' % path)