check for result directory deletion if run in interactive mode. Checks only if in a tty

This commit is contained in:
2026-08-18 10:30:06 +09:00
parent f5e5df488f
commit 8393d7f923
+6 -1
View File
@@ -11,10 +11,15 @@ def main(config_yaml):
result_dir = config["io"]["result_dir"]
if os.path.exists(result_dir):
if sys.stdin.isatty():
answer = input(f"Will delete {result_dir}: [y/N]\n> ").strip().lower() == 'y'
if not answer:
print("Aborted.")
return
shutil.rmtree(result_dir)
os.makedirs(result_dir, exist_ok=True)
shutil.copy(config_yaml, os.path.join(result_dir, os.path.basename(config_yaml)))
pipelines.job_types[config['job']['type']](config)