From 218c9e203bb3034a5fc787cdf139319b38e4d116 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 27 Oct 2026 22:40:35 +0000 Subject: [PATCH] Abort setup when create-vue is interrupted or cancelled create-vue exits 0 when its prompts are cancelled, so a zero return code is not proof of success: also require frontend/package.json to exist, and treat Ctrl-C (KeyboardInterrupt) as failure instead of a traceback. The caller already exits 1 on failure, so the setup no longer continues with a missing or partial frontend. --- fastapi_vue_setup.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/fastapi_vue_setup.py b/fastapi_vue_setup.py index 88ba4b4..582c1b4 100644 --- a/fastapi_vue_setup.py +++ b/fastapi_vue_setup.py @@ -1499,9 +1499,15 @@ def ensure_frontend( if not vue_args: print("(Follow the prompts to configure your Vue app)") print() - result = subprocess.run(create_cmd, cwd=project_dir, check=False) # noqa: S603 - if result.returncode != 0: - print("āŒ create-vue failed") + try: + result = subprocess.run(create_cmd, cwd=project_dir, check=False) # noqa: S603 + except KeyboardInterrupt: + print("\nāŒ create-vue interrupted") + return False + # create-vue exits 0 when its prompts are cancelled, so a zero return + # code alone doesn't mean a project was created. + if result.returncode != 0 or not package_json.exists(): + print("āŒ create-vue failed or was cancelled") return False return True