提交 2fb29ee8 authored 作者: Zach Ploskey's avatar Zach Ploskey

close files and fix comment typo

上级 efad433e
...@@ -178,9 +178,11 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -178,9 +178,11 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
other_dead = False other_dead = False
while os.path.isdir(tmp_dir): while os.path.isdir(tmp_dir):
try: try:
read_owner = open(lock_file).readlines()[0].strip() with open(lock_file) as f:
# the try is transtion code for old locks read_owner = f.readlines()[0].strip()
# it may be removed when poeple have upgraded
# The try is transition code for old locks.
# It may be removed when people have upgraded.
try: try:
other_host = read_owner.split('_')[2] other_host = read_owner.split('_')[2]
except IndexError: except IndexError:
...@@ -250,7 +252,9 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1): ...@@ -250,7 +252,9 @@ def lock(tmp_dir, timeout=120, min_wait=5, max_wait=10, verbosity=1):
# Verify we are really the lock owner (this should not be needed, # Verify we are really the lock owner (this should not be needed,
# but better be safe than sorry). # but better be safe than sorry).
owner = open(lock_file).readlines()[0].strip() with open(lock_file) as f:
owner = f.readlines()[0].strip()
if owner != unique_id: if owner != unique_id:
# Too bad, try again. # Too bad, try again.
continue continue
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论