From fc9f9ed775026ed217b8305a45afc36269484ddf Mon Sep 17 00:00:00 2001 From: Trim21 Date: Mon, 22 Apr 2024 22:21:24 +0800 Subject: [PATCH] fix: windows exit code with python (#2055) Closes #2048 --- maturin/__main__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/maturin/__main__.py b/maturin/__main__.py index db5e84fb1..61250910a 100644 --- a/maturin/__main__.py +++ b/maturin/__main__.py @@ -41,4 +41,10 @@ def script_exists(dir: str) -> bool: print("Unable to find `maturin` script") exit(1) - os.execv(maturin, [str(maturin)] + sys.argv[1:]) + if sys.platform == "win32": + import subprocess + + code = subprocess.call([str(maturin)] + sys.argv[1:]) + sys.exit(code) + else: + os.execv(maturin, [str(maturin)] + sys.argv[1:])