View Single Post
Old 28th June 2010, 13:27   #1
nsnb
Senior Member
 
Join Date: Jul 2008
Posts: 157
Question ExecWait doesn't wait (on Windows 7)

I came across this problem while testing the uninstall part of an NSIS script:

Despite not changing anything in the -un.post section that takes care of removing all Start Menu entries:
PHP Code:
  ;Delete empty start menu parent diretories
  StrCpy $MUI_TEMP 
"${D_STARTMENU}"
SMDELOOP:
    
ClearErrors
    RMDir $MUI_TEMP
    GetFullPathName $MUI_TEMP 
"$MUI_TEMP\.."
    
IfErrors SMDELDONE
    StrCmp $MUI_TEMP $SMPROGRAMS SMDELDONE SMDELOOP
SMDELDONE

The uninstaller no longer deletes the last (topmost) entry in the Start Menu. In my attempts to troubleshoot this I discovered that this is not always consistent: Sometimes it deletes and sometimes it doesn't.

So, I decided to place a MessageBox line right after the 'RMDir $MUI_TEMP' line:
PHP Code:
    RMDir $MUI_TEMP
MessageBox MB_OK
|MB_ICONEXCLAMATION "Removed $MUI_TEMP"    ; for debug only
    GetFullPathName $MUI_TEMP 
"$MUI_TEMP\.." 
And I was surprised to see that this message box is displayed while an ExecWait from a previous un.Uninstall section was still in progress...
PHP Code:
ExecWait '"$INSTDIR\vcredist_x86.exe" /q:a /c:"VCREDI~1.EXE /q:a /c:""msiexec /x vcredist.msi /qb!"" "' 
Obviously, something is happening here in parallel but how could this be?
  1. Isn't ExecWait supposed to wait?
  2. Isn't Section -un.post supposed to start after all Section "un.Uninstall"s?

Most importantly: How would you suggest that I solve (or workaround) this problem?

Thanks!
nsnb is offline   Reply With Quote