Fix race-condition bug on upgrade
This commit is contained in:
parent
be5d17ab42
commit
86d802882a
|
@ -91,7 +91,12 @@ def main():
|
||||||
|
|
||||||
if WormConfiguration.use_file_logging:
|
if WormConfiguration.use_file_logging:
|
||||||
if os.path.exists(log_path):
|
if os.path.exists(log_path):
|
||||||
os.remove(log_path)
|
# If log exists but can't be removed it means other monkey is running. This usually happens on upgrade
|
||||||
|
# from 32bit to 64bit monkey on Windows. In all cases this shouldn't be a problem.
|
||||||
|
try:
|
||||||
|
os.remove(log_path)
|
||||||
|
except OSError:
|
||||||
|
pass
|
||||||
LOG_CONFIG['handlers']['file']['filename'] = log_path
|
LOG_CONFIG['handlers']['file']['filename'] = log_path
|
||||||
LOG_CONFIG['root']['handlers'].append('file')
|
LOG_CONFIG['root']['handlers'].append('file')
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue