Description

Plug-in works with console applications - creates hidden child process with redirected i/o. Compare to NSISdl has 4 add-ons: 1) string parameter that serves as stdin for running application; 2) sync/async process launch option; 3) works out of section as well; 4) multithreading.  First may be useful if you want to give login/password to the running application, second - for long running applications, third - for .onInit function check outs, fourth - to run few DOS application at a time. Plug-in puts log to file instead of 'detailed' installer window (optional). Maximim input string size is 8kB in the special NSIS build, 1 kB otherwise.


How To Use

  ExecDos::exec [/NOUNLOAD /ASYNC] [/TIMEOUT=xxx] application_to_run [stdin_string] [log_file_name]

  /ASYNC - not waits for process exit. Use 'wait' to get exit code
  /TIMEOUT - TOTAL execution time, milliseconds, for example /TIMEOUT=10000. 
            Default is big enough. Short timeouts may cause app to be terminated. 
  application_to_run - application to run (required). 
  stdin_string - all that application can get from stdin (optional) 
  log_file_name - file where to put app's stdout (optional)
Please note - last 2 parameters are optional if installer stack is empty. More safe is to set un-used to ""


Example of async launch

  ExecDos::exec /NOUNLOAD /ASYNC "$EXEDIR\consApp.exe" "test_login$\ntest_pwd$\n" "$EXEDIR\execdos.log"
  Pop $0 ; thread handle for wait
  ExecDos::wait $0
  Pop $0 ; exit code
  MessageBox MB_OK "Exit code $0"

sync launch

  ExecDos::exec "$EXEDIR\consApp.exe" "" ""
  Pop $0 ; exit code
  MessageBox MB_OK "Exit code $0"


BAT files specifics

On some of Win98 systems where "Close on exit" option is not set for DOS apps. As a result after batch execution was finished (and installer continue it's job) hidden window still remains in the system as "winoldapp". Following two lines solve the problem 

@echo off
# place your code here
cls
Telnet and ssh Plug-in not works with applications requiring terminal emulation.


Takhir Bedertdinov, INEUM, Moscow, Russia
