gu exits a Windows bat file
Describe GraalVM and your environment:
- CE or EE: CE
- JDK version: JDK17
- OS and OS Version: Windows 10
- Architecture: amd64
Describe the issue
I’m trying to make the life of my users a bit easier and provide a script for Linux/Mac and Windows to install GraalVM including Graal.js. Works fine on Linux/Mac but on Windows (.bat file) it seems that gu install js exits the bat file, so all commands after gu install js aren’t executed. I’ve tried options -A -N without success.
Hi, thank you for reporting this, could you please share the script you use for Windows? Also, which version of GraalVM you're using? Thank you
Here we go:
@echo off
setlocal enableDelayedExpansion
set "MISSING_REQUIREMENTS=false"
CALL :check_requirement curl curl
CALL :check_requirement tar tar
IF "%MISSING_REQUIREMENTS%"=="true" (
echo The above commands are missing on your computer. Please install it and execute this script again.
exit /b
)
set EXTRACTED=graalvm-ce-java17-22.2.0
set JAVA_HOME=%cd%/../%EXTRACTED%
if exist "%JAVA_HOME%" (
if "%1" == "-d" (
rmdir /Q /S "%JAVA_HOME%"
) else (
@echo %EXTRACTED% is already installed.
exit
)
)
set DOWNLOADURL=https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-22.2.0/graalvm-ce-java17-windows-amd64-22.2.0.zip
if defined proxyhost (
if defined proxyport (
echo Using proxy %proxyhost%:%proxyport%
set CURLPROXY=--proxy %proxyhost%:%proxyport%
set GUPROXY=--vm.Dhttp.proxyHost=%proxyhost% --vm.Dhttp.proxyPort=%proxyport% --vm.Dhttps.proxyHost=%proxyhost% --vm.Dhttps.proxyPort=%proxyport%
)
)
@echo Installing %EXTRACTED% ...
curl %CURLPROXY% -L -o graalvm.zip %DOWNLOADURL%
tar xf graalvm.zip --directory ../
del "graalvm.zip"
set EXECUTABLES=%JAVA_HOME%/bin
@echo The following version of GraalVM has been installed for this SwiftMQ Router:
%EXECUTABLES%/java -version
@echo !JAVA_HOME!>.javahome
@echo !EXECUTABLES!>.executables
@echo Installing Graal.js which is necessary to execute SwiftMQ Streams ...
%EXECUTABLES%/gu %GUPROXY% install js
@echo Installation complete.
exit
rem Ensures that the system has a specific program installed on the PATH.
:check_requirement
set "MISSING_REQUIREMENT=true"
where %1 > NUL 2>&1 && set "MISSING_REQUIREMENT=false"
IF "%MISSING_REQUIREMENT%"=="true" (
echo Please download and install %2
set "MISSING_REQUIREMENTS=true"
)
exit /b
This line is not executed:
@echo Installation complete.
I Apology for not returning to you earlier about this issue. I verified the script and was able to run it successfully. I'll close this issue as "not a bug", if you still need assistance, please reopen or create a new issue. Thank you.
Do you see
Installation complete.
at the end?
Sorry, I misunderstood the issue at first, I thought the issue is gu not installing when running from a script file.
This problem can be mitigated using the call command of windows that suppresses exiting after gu execution...
So the particular line of code in the script should be
call %EXECUTABLES%/gu %GUPROXY% install js
Thank you. Not a solution but a workaround.