Archive: ExecDos keeps "trapping"


ExecDos keeps "trapping"
I'm trying to start a console program (MakeCab.exe actually) in to background silently, and ExecDos seemed to suit well. But something is wrong as this code example keeps trapping all the time.

Please tell me what I'm doing wrong here (Far nor Makecab never starts):

!include "nsDialogs.nsh"

!AddPluginDir .

OutFile "test4.exe"

Page license
Page custom nsDialogs_Create nsDialogs_Leave
Page license

Var handle

Function nsDialogs_Create

nsDialogs::Create /NOUNLOAD 1018
Pop $0
StrCmp $0 error 0 +2
Abort

${NSD_CreateLabel} 10u 10u 100% 10u "Please, wait a minute while backup files are being compressed."
Pop $0

GetDlgItem $R1 $HWNDPARENT 1 ; disable NEXT button
GetDlgItem $R2 $HWNDPARENT 2 ; disable CANCEL button
GetDlgItem $R3 $HWNDPARENT 3 ; disable BACK button
EnableWindow $R1 0
EnableWindow $R2 0
EnableWindow $R3 0

ExecDos::exec /NOUNLOAD /ASYNC "C:\Program Files\FAR\Far.exe"
Pop $handle # thread handle for wait

${NSD_CreateTimer} Timer1 1000

nsDialogs::Show

FunctionEnd

Function nsDialogs_Leave
FunctionEnd

Function Timer1

ExecDos::isdone $handle ; return 1 if application have exited, 0 if still running, -1 on error
Pop $0
IntCmp $0 0 processfound error processnotfound

error:
MessageBox MB_OK "ExecDos::isdone failed."
Abort

processnotfound:
${NSD_KillTimer} Timer1
EnableWindow $R1 1
EnableWindow $R2 1
EnableWindow $R3 1
;Goto END

processfound:

FunctionEnd

Section
SectionEnd

Thank You.

I guess

ExecDos::exec /NOUNLOAD /DETAILED /ASYNC "C:\Program Files\FAR\Far.exe" ""
may help. Probably /NOUNLOAD required for isdone.

Yes, tried quickly adding the /NOUNLOAD after isdone and it didn't trap yet, thank you.

I didn't even think that isdone could need that parameter too, because there were no mension of it in the help page.

I'll be testing this more closely in a bigger script tomorrow.