mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
231f5423dd
commit
cba932362f
@ -339,7 +339,7 @@ else:
|
|||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
def tdirs_in(b):
|
def tdirs_in(b, check_for_lock=False):
|
||||||
try:
|
try:
|
||||||
tdirs = os.listdir(b)
|
tdirs = os.listdir(b)
|
||||||
except EnvironmentError as e:
|
except EnvironmentError as e:
|
||||||
@ -348,7 +348,7 @@ def tdirs_in(b):
|
|||||||
tdirs = ()
|
tdirs = ()
|
||||||
for x in tdirs:
|
for x in tdirs:
|
||||||
x = os.path.join(b, x)
|
x = os.path.join(b, x)
|
||||||
if os.path.isdir(x):
|
if os.path.isdir(x) and (not check_for_lock or os.path.exists(os.path.join(x, TDIR_LOCK))):
|
||||||
yield x
|
yield x
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ class IPCLockTest(unittest.TestCase):
|
|||||||
child = run_worker('calibre.utils.test_lock', 'other4')
|
child = run_worker('calibre.utils.test_lock', 'other4')
|
||||||
tdirs = []
|
tdirs = []
|
||||||
while not tdirs:
|
while not tdirs:
|
||||||
tdirs = list(tdirs_in('t'))
|
tdirs = list(tdirs_in('t', check_for_lock=True))
|
||||||
self.assertTrue(is_tdir_locked(tdirs[0]))
|
self.assertTrue(is_tdir_locked(tdirs[0]))
|
||||||
c2 = run_worker('calibre.utils.test_lock', 'other5')
|
c2 = run_worker('calibre.utils.test_lock', 'other5')
|
||||||
c2.wait()
|
c2.wait()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user