Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e53ef4a

Browse files
committed
Kotlin/Bazel: fix wrapper on Windows
1 parent b07fa70 commit e53ef4a

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

java/kotlin-extractor/deps/dev/kotlinc

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ is available in `resources/lib/windows/ripunzip` then).
1515
"""
1616

1717
import pathlib
18-
import os
1918
import urllib
2019
import urllib.request
2120
import urllib.error
@@ -29,6 +28,7 @@ import io
2928

3029
DEFAULT_VERSION = "1.9.0"
3130

31+
3232
def options():
3333
parser = argparse.ArgumentParser(add_help=False)
3434
parser.add_argument("--select")
@@ -71,6 +71,7 @@ def check_version(version: str):
7171
raise Error(f"Version {version} not found in github.com/JetBrains/kotlin/releases") from e
7272
raise
7373

74+
7475
def get_version(file: pathlib.Path) -> str:
7576
try:
7677
return file.read_text()
@@ -108,9 +109,12 @@ def forward(forwarded_opts):
108109
kotlinc = install_dir / "kotlinc" / "bin" / "kotlinc"
109110
if platform.system() == "Windows":
110111
kotlinc = kotlinc.with_suffix(".bat")
111-
args = [sys.argv[0]]
112+
assert kotlinc.exists(), f"{kotlinc} not found"
113+
args = [kotlinc]
112114
args.extend(forwarded_opts)
113-
os.execv(kotlinc, args)
115+
ret = subprocess.run(args).returncode
116+
sys.exit(ret)
117+
114118

115119
def clear():
116120
if install_dir.exists():
@@ -123,6 +127,7 @@ def clear():
123127
print(f"removing {version_file}", file=sys.stderr)
124128
version_file.unlink()
125129

130+
126131
def main(opts, forwarded_opts):
127132
if opts.clear:
128133
clear()
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
@echo off
2-
python3 %~dp0/kotlinc
2+
3+
python "%~dp0/kotlinc" %*
4+
exit /b %ERRORLEVEL%

0 commit comments

Comments
 (0)