From e4edf35833289f206ec7a9d4f2002968b904f1a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Bompard?= Date: Wed, 12 Jun 2024 16:49:33 +0200 Subject: [PATCH] Adjust generate-typescript-types after uvicorn's new signal handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Aurélien Bompard --- generate-typescript-types.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/generate-typescript-types.py b/generate-typescript-types.py index f37fc6502..63e9495b9 100755 --- a/generate-typescript-types.py +++ b/generate-typescript-types.py @@ -6,6 +6,7 @@ import os import shutil +import signal import socket import time from contextlib import closing, contextmanager @@ -39,9 +40,10 @@ def running(cmd): try: yield proc finally: - proc.terminate() + proc.send_signal(signal.SIGINT) proc.wait(timeout=10) - if proc.returncode != 0: + # The Uvicorn process now returns 1 when it recieves SIGINT + if proc.returncode not in (0, 1): raise CalledProcessError(proc.returncode, proc.args, proc.stdout, proc.stderr) @@ -62,7 +64,7 @@ def main(): os.environ["DATABASE__SQLALCHEMY__URL"] = "sqlite:///" print("Running API") with running([fmn_cmd, "api", "serve", "--port", str(port)]): - time.sleep(2) + time.sleep(3) with pushd("frontend"): print("Building Typescript types") call(