Skip to content
⌘ NSIS Forum Archive

How to log stdout on exec

7 posts

torpark#

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#
Perhaps the included nsExec plugin?

And if I remember correctly there are a couple of similar command line plugins in wiki.
torpark#
Why is there no documentation of nsExec anywhere?

And what is the difference between nsExec::Exec, ExecToLog, and ExecToStack?
torpark#
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#edited
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,



kichik#
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.