forked from github/server
bugfix stale locks
This commit is contained in:
parent
29dd35b877
commit
ef95b37b9f
|
@ -16,7 +16,13 @@ if (trylock(sys.argv[1]+'.err')!=0):
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
# move input file then unlock it:
|
# move input file then unlock it:
|
||||||
|
if os.access(sys.argv[1]+'.err', os.F_OK)==0:
|
||||||
|
unlock(sys.argv[1]+'.err')
|
||||||
|
sys.exit();
|
||||||
|
|
||||||
|
try:
|
||||||
os.rename(sys.argv[1]+'.err', sys.argv[1]+'.tmp')
|
os.rename(sys.argv[1]+'.err', sys.argv[1]+'.tmp')
|
||||||
|
finally:
|
||||||
unlock(sys.argv[1]+'.err')
|
unlock(sys.argv[1]+'.err')
|
||||||
|
|
||||||
infile=open(sys.argv[1]+".tmp", "r")
|
infile=open(sys.argv[1]+".tmp", "r")
|
||||||
|
|
Loading…
Reference in New Issue