Merge pull request #17232 from github/redsun82/kotlin

Kotlin: fix wrapper on windows and use `os.execv` on POSIX
This commit is contained in:
Paolo Tranquilli
2024-08-15 12:50:46 +02:00
committed by GitHub

View File

@@ -122,10 +122,13 @@ def forward(tool, forwarded_opts):
if platform.system() == "Windows":
tool = tool.with_suffix(".bat")
assert tool.exists(), f"{tool} not found"
args = [tool]
args.extend(forwarded_opts)
ret = subprocess.run(args).returncode
cmd = [tool] + forwarded_opts
if platform.system() == "Windows":
# kotlin bat script is pretty sensible to unquoted args on windows
ret = subprocess.run(" ".join(f'"{a}"' for a in cmd)).returncode
sys.exit(ret)
else:
os.execv(cmd[0], cmd)
def clear():