Skip to content

Commit 70e4aaf

Browse files
author
Vladimir Kotal
committed
remove temp file on error
1 parent b936133 commit 70e4aaf

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docker/start.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,15 +458,17 @@ def main():
458458
out_file = None
459459
with tempfile.NamedTemporaryFile(mode='w+', delete=False,
460460
prefix='merged_config') as tmp_out:
461+
out_file = tmp_out.name
461462
merge_config_files(read_only_config_file, OPENGROK_CONFIG_FILE,
462463
tmp_out, jar=OPENGROK_JAR, loglevel=log_level)
463-
out_file = tmp_out.name
464464

465465
if out_file and os.path.getsize(out_file) > 0:
466466
shutil.move(tmp_out.name, OPENGROK_CONFIG_FILE)
467467
else:
468468
logger.warning('Failed to merge read-only configuration, '
469469
'leaving the original in place')
470+
if out_file:
471+
os.remove(out_file)
470472

471473
if use_projects:
472474
num_workers = get_num_from_env(logger, 'WORKERS',

0 commit comments

Comments
 (0)