exit(1) does not set exit code in Windows?

13 vues (au cours des 30 derniers jours)
Kris Thielemans
Kris Thielemans le 5 Sep 2015
Commenté : Amol Koli le 9 Juil 2019
hi
I'm trying to write a test-suite for MATLAB code. In my test script, I use exit(1) to be able to tell my build system (make) if the test failed. This works fine on Linux and MacOS. However, on Windows, the return code of MATLAB is always 0, even with the following
C:\Users\Kris>matlab -nodisplay -nosplash -nojvm -r "exit(1)"
C:\Users\Kris>echo %ERRORLEVEL%
0
Is this a bug, or do I misunderstand something? I'm using R2014b.

Réponses (2)

Walter Roberson
Walter Roberson le 5 Sep 2015
  1 commentaire
Kris Thielemans
Kris Thielemans le 5 Sep 2015
thanks Walter. sadly, I had tried this and it doesn't work. I should have mentioned this. sorry

Connectez-vous pour commenter.


Tyler Cumby
Tyler Cumby le 18 Juil 2018
This question is a bit old, but for those who still have it, instead of calling the matlab.exe in &ltMATLAB root&gt/bin, call MATLAB.exe in &ltMATLAB root&gt/bin/&ltarch&gt. That is,
start /wait "%PROGRAMFILES%\MATLAB\R2017b\bin\win64\MATLAB.exe" -nodesktop -nosplash -r "exit(1)"
  1 commentaire
Amol Koli
Amol Koli le 9 Juil 2019
Doesn't work either

Connectez-vous pour commenter.

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by