nsExec never returns (or doesn't return before timeout occurred) if the called application returns with exit code 259 (ERROR_NO_MORE_ITEMS). nsExec checks lpExitCode != STILL_ACTIVE of the function GetExitCodeProcess in a loop which should be avoided (see MSDN: GetExitCodeProcess -> Warning: ...).
Use WaitForSingleObject instead to wait for the process handle returned by CreateProcess. The handle is signaled if the process finishes. Call GetExitCodeProcess if WaitForSingleObject returned successfully.
Logged In: YES
user_id=584402
Originator: NO
Thanks, fixed.