Archive: nsExec: redirect into file with blanks in name


nsExec: redirect into file with blanks in name
Hi,


I'm having troubles while using the nsexec plugin.

You can reproduce the problem by using the following code:

ReadEnvStr $R0 COMSPEC
nsExec::ExecToLog '"$R0" /c "d:\test space\mysql" --version > d:\test_space\mysql_version.txt'

This works perfectly fine, the output (in this case the version number of a mysql-binary is written in to the (log)-file mysql_version.txt.
However, as soon as the output path for the logfile contains spaces, the code breaks. One would think that putting the log-file into quotes would cure the problem:

nsExec::ExecToLog '"$R0" /c "d:\test space\mysql" --version > "d:\test space\mysql_version.txt"'

However, now I'm getting: command "d:\test" cannot be found. Is that the intended behaviour? Any ideas how to overcome that? Of course I could choose directories without spaces, but I would like to write the logfile into $INSTDIR\mysql\logs, and $INSTDIR might have spaces in its path.

Thanks for any clarification

playa_negra


That's cmd.exe quotes processing working for you. Add if 1==1 at the beginning and it won't do that.

nsExec::ExecToLog '"$R0" /c if 1==1 "whatever" > "whatever"'

You can also test this with ExecDos plug-in. Also please do not skip executable file name extension, use mysql.exe


@kickik:
Thanks for your advice. I don't know why it works, but it works.

@Takhir:
I saw you can capture STDOUT via log_file_name. Can you capture STDERR, too?

Thanks

playa_negra


Stderr capture is possible, but not in current release.