In my .nsi file I am calling ExecWait '"$INSTDIR\application.exe" ' $0
. In application.exe I am returning exit codes for success and failures. How to catch those exit codes in .nsi file.
how to get the exit code of other application in nsis
If there is an error performing ExecWait, then the contents of the user variable passed in is undefined.
To simply check if the program executed correctly or not, 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:
The exit code of the application will be stored in the variable that is passed as the 2nd argument to ExecWait, so $0 in your example.
i am passing integer 1 as success and integer 2 as failure, but when i I execute above ExecWait code, I am always getting 0 as its value. Can u please tel me how should I send return value in application (C++ code) –
Derogatory
I'm no c++ expert but I would imagine that using the return function is the way to specify the exit code –
Ecbolic
i need not know exactly in C++, any other programming language also ok. I am returning error code from function of my application. I call that application in my .nsi file but not getting the error code which I am sending. Please help me out –
Derogatory
Could you paste an excerpt of the
main()
of your c++ program ? Basically, at the end of the code, if you put a return 42;
that 42 value should be catched in the variable that you give to ExecWait
–
Calcific © 2022 - 2024 — McMap. All rights reserved.