I'm currently trying to setup Jenkins to run MATLAB Tests and I have troubles getting output sometimes. I'm calling MATLAB in a pipeline via
bat '"PATH/matlab" -wait -nosplash -nodesktop -nogui -r "COMMAND"'
If COMMAND is exit(0)
or exit(1)
the step ends with the correct error code. However, if an error occurs e.g. if COMMAND is error(\'some error\')
(or simply error
) then MATLAB seems to never return. What could be the reason of this? How can I make MATLAB return with an error code to Jenkins if an error occurs?