Closed geerligs closed 1 year ago
Hi Han,
I'm not seeing the described behavior when following the reproduction steps:
What version of Jenkins are you running? What version of Windows are you running? Are you running on a local or remote agent?
The note about the splash screen is interesting as well. I would not expect to see that on R2015b with the plugin. If you open a cmd.exe prompt on the machine running your Jenkins job and run "C:\Program Files\MATLAB\R2015b\bin\matlab.exe" -nosplash -nodesktop -wait -log -r "version, exit"
, can you post a screenshot of the output you see in the command prompt?
Best, Mark
Hi Mark,
I'm running Jenkins 2.390. Windows 10 21H2. Running on a local agent
When running your CLI line:
Is there any way of retrieving the files (bat file) inside the temporary folder .matlab/* ? We might use this to obtain better understanding of the issue.
Thanks for the quick response.
--Han
Can you try swapping out your "Run MATLAB Command" step with a simple "Execute Windows batch command" step that calls matlab.exe -nosplash -nodesktop -wait -log -r "version, exit"
like so (keep the Use MATLAB version setting):
If you run this, is the output of version printed to your Jenkins log? Do you see the MATLAB splash screen like you were seeing before?
You may be able to preserve the .matlab folder but lets see if we do a few other debug steps first.
Hi Mark,
this is the response:
I did not see the Matlab Splash pop up.
--Han
Thanks Han, we'll look into it over here. The only difference I am seeing is that "Execute Windows batch command" is using cmd /c call
and appears to be printing output properly on your machine, where as "Run MATLAB Command" is using cmd /c
and does not appear to be printing output properly on your machine.
You can set up a "Run MATLAB Command" build step that runs copyfile('.matlab','.matlab-saved')
and then look in the ".matlab-saved" folder of your Jenkins project workspace if you want to take a look at the scripts being run. Ultimately, on R2015b, it should come down to calling something very similar to matlab.exe -nosplash -nodesktop -wait -log -r ...
which is why I'm surprised you are seeing a splash screen.
Mark,
Thanks for your response.
Unfortunately the command copyfile('.matlab','.matlab-saved')
will not save the (generated) bat-file because somehow this is not running properly. Do you have any other clue how to retrieve the generated bat file?
--Han
Hi Mark,
I found the cause of the error. I was accidentally setting the ERRORLEVEL variable in my profile:
set ERRORLEVEL
ERRORLEVEL = test;
This is causing the generated bat file to stop executing for <R2019a
rem use -r to launch MATLAB versions below R2018b (i.e. 9.5), otherwise use -batch
call :ver_less_than %matlab_ver% 9.5
if %errorlevel% == 0 (
rem define start-up options
set opts=-nosplash -nodesktop -wait -log
call :ver_less_than %matlab_ver% 8.5
if not !errorlevel! == 0 set opts=!opts! -noDisplayDesktop
rem escape single quotes in command
set exp=!command:'=''!
matlab.exe !opts! -r "try,eval('!exp!'),catch e,disp(getReport(e,'extended')),exit(1),end,exit" > NUL
) else (
matlab.exe -batch "%command%"
)
Why is errorlevel checked ? You might consider setting errorlevel locally to 0 by using the setlocal command.
Thanks again for your continued support. I will close this issue for now.
--Han
Thanks for letting us know Han. I created #234 to track this issue and get it fixed.
Hello,
just today I found that when running a Matlab Command step for any Matlab version below R2019a didn't execute.
way to reproduce:
Then on the command line the correct Matlab root is added (e.g. C:\Program Files\MATLAB\R2015b\bin)
However the requested display is not shown.
After modifying the MATLAB release to R2019a the command is correctly executed: In this case the splash screen is not showing up.
I have tested this for Matlab Jenkins plugin 2.8.0 and 2.9.0. I have tested for MATLAB R2007b, R2012a, R2015b, R2019a and R2022b
regards, Han