torpark
13th June 2007 16:02 UTC
How to log stdout on exec
I am calling a commandline dos application. Normally I use Exec and it would show the window. For some reason it isn't showing the window but the process is running. At this point I would like to show the window and log the output to a file. Are there any execs that can do this asynchronously?
Red Wine
13th June 2007 16:22 UTC
Perhaps the included nsExec plugin?
And if I remember correctly there are a couple of similar command line plugins in wiki.
torpark
13th June 2007 17:18 UTC
Why is there no documentation of nsExec anywhere?
And what is the difference between nsExec::Exec, ExecToLog, and ExecToStack?
Red Wine
13th June 2007 17:29 UTC
On my machine it is here: C:\Program Files\NSIS\Docs\nsExec
torpark
13th June 2007 17:37 UTC
I've seen that but there are no examples.
It claims to log output, but the syntax shown does not address the log.
example:
nsExec::Exec "SomeProgram.exe" "$EXEDIR\log.txt"
this runs SomeProgram but does not indeed create a log of the output to log.txt
Am I missing someting here?
Further, no window is created, which I did want but can live without.
Red Wine
13th June 2007 17:52 UTC
EDIT: There is an example in C:\Program Files\NSIS\Examples\nsExec
Did you search the forum for examples? I guess there would be some.
Also these 2 plugins from wiki with examples,
http://nsis.sourceforge.net/ExecCmd_plug-in
http://nsis.sourceforge.net/ExecDos_plug-in
kichik
13th June 2007 19:15 UTC
nsExec::Exec ignores the output, nsExec::ExecToLog shows the output in your installer log and nsExec::ExecToStack pushes the output to the stack.
As the documentation says:
All functions are the same except ExecToLog will print the output to the log window and ExecToStack will push up to ${NSIS_MAX_STRLEN} characters of output onto the stack after the return value.