How to get the exit code of another application in nsis

In my .nsi file I call ExecWait '"$INSTDIR\application.exe" ' $0 . In application.exe, I return exit codes for success and failure. How to catch these exit codes in a .nsi file.

+4
source share
2 answers

The application termination code will be stored in a variable that is passed as the second argument to ExecWait, so in your example there will be $ 0.

http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.4

+4
source

If an error occurred while executing ExecWait, then the contents of the user variable that passed through will be undefined.

To simply verify that the program is executed correctly, check the error flag. (btw, NSIS expects zero for success and non-zero for error)

 ClearErrors ExecWait '"$INSTDIR\application.exe"' IfErrors 0 noError ; Handle error here noError: 
+4
source

Source: https://habr.com/ru/post/1393732/


All Articles