Archive: ExecWait


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.


Seems like quotes issue.


Yep, put "" around your jar path and $8 in case they contain spaces.

Stu


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


No, read me post again :p
ExecWait '"$SYSDIR\java" -jar "$INSTDIR\cqsvn-client.jar" "$8" stop' $0

Stu


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


It could be because you are missing the exe from the end of java.

Stu


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.


Unless you do:

ReadEnvStr $R0 COMSPEC
ExecWait `"$R0" /C java ...`

Stu


Stu
Isn't it just as good to omit the ReadEnvStr like this?

ExecWait '"$%COMSPEC%" /C java ...'

Don

no, $%% is for the system you compile on


Ahhh, I see it in the manual now. Thanks for enlightening me.

Don