- NSIS Discussion
- ExecWait
Archive: ExecWait
norricorp
30th July 2007 20:02 UTC
ExecWait
During uninstall I check that a process is running and then use ExecWait to call a stop command.
So my code has
ExecWait '"$SYSDIR\java" -jar $INSTDIR\cqsvn-client.jar $8 stop' $0
Messagebox MB_OK "return value is $0"
StrCmp $0 "0" not_found
Messagebox ....
So the first messagebox is just to see the result.
And the result is always non zero. The command on the command line and from a shortcut works fine.
Any ideas?
Of course there is the problem of whether this is the correct approach as I have to search for javaw rather than something.exe which is far more specific. But one thing at a time.
Red Wine
30th July 2007 21:11 UTC
Seems like quotes issue.
Afrow UK
30th July 2007 22:41 UTC
Yep, put "" around your jar path and $8 in case they contain spaces.
Stu
norricorp
31st July 2007 09:23 UTC
I had tried quotes around individual parameters before so
ExecWait '"$SYSDIR\java" "-jar $INSTDIR\cqsvn-client.jar" "$8" "stop"' $0
which gave same result.
Do you mean putting the whole lot in quotes ie
ExecWait '"$SYSDIR\java -jar $INSTDIR\cqsvn-client.jar $8 stop"' $0
or separate command from params ie
ExecWait '"$SYSDIR\java" "-jar $INSTDIR\cqsvn-client.jar $8 stop"' $0
Afrow UK
31st July 2007 12:39 UTC
No, read me post again :p
ExecWait '"$SYSDIR\java" -jar "$INSTDIR\cqsvn-client.jar" "$8" stop' $0
Stu
norricorp
1st August 2007 19:23 UTC
Stu,
tried
ExecWait '"$SYSDIR\java" -jar "$INSTDIR\cqsvn-client.jar" "$8" stop' $0
Messagebox MB_OK "return value is $0"
and message box showed a reply of 1 (ie non zero) and process is still happily running though if the above command runs on the command line or from start menu then kills process.
Any other ideas? Are there known problems with the ExecWait command?
Regards,
John
Afrow UK
1st August 2007 19:29 UTC
It could be because you are missing the exe from the end of java.
Stu
norricorp
5th August 2007 09:58 UTC
Stu,
the .exe did not work. I was using a named.exe before with the KillProc plugin that worked fine but using KillProc with Javaw is probably a bit risky! So I have a routine that sends a message to the listener program and ask it to stop. This works on the command line but not from ExecWait.
There is a workaround - I can use KillProc to look for javaw and put out a message to manually stop the process. Of course still risky because if there are other javaw processes running then the uninstall will keep aborting with the message.
Anyway it looks as though ExecWait and my use of javaw do not work together. Thanks for all your help and patience.
Afrow UK
5th August 2007 17:56 UTC
Unless you do:
ReadEnvStr $R0 COMSPEC
ExecWait `"$R0" /C java ...`
Stu
demiller9
5th August 2007 20:56 UTC
Stu
Isn't it just as good to omit the ReadEnvStr like this?
ExecWait '"$%COMSPEC%" /C java ...'
Don
Anders
5th August 2007 22:24 UTC
no, $%% is for the system you compile on
demiller9
6th August 2007 00:57 UTC
Ahhh, I see it in the manual now. Thanks for enlightening me.
Don