File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,7 +15,6 @@ is available in `resources/lib/windows/ripunzip` then).
1515"""
1616
1717import pathlib
18- import os
1918import urllib
2019import urllib .request
2120import urllib .error
@@ -29,6 +28,7 @@ import io
2928
3029DEFAULT_VERSION = "1.9.0"
3130
31+
3232def 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+
7475def 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
115119def 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+
126131def main (opts , forwarded_opts ):
127132 if opts .clear :
128133 clear ()
Original file line number Diff line number Diff line change 11@ echo off
2- python3 %~dp0 /kotlinc
2+
3+ python " %~dp0 /kotlinc" %*
4+ exit /b %ERRORLEVEL%
You can’t perform that action at this time.
0 commit comments