Old 26th September 2007, 20:51   #1
playa_negra
Junior Member
 
Join Date: Sep 2007
Location: Germany
Posts: 3
Question 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
playa_negra is offline   Reply With Quote
Old 27th September 2007, 10:22   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
That's cmd.exe quotes processing working for you. Add if 1==1 at the beginning and it won't do that.
code:
nsExec::ExecToLog '"$R0" /c if 1==1 "whatever" > "whatever"'

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 27th September 2007, 10:24   #3
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
You can also test this with ExecDos plug-in. Also please do not skip executable file name extension, use mysql.exe
Takhir is offline   Reply With Quote
Old 27th September 2007, 15:19   #4
playa_negra
Junior Member
 
Join Date: Sep 2007
Location: Germany
Posts: 3
@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
playa_negra is offline   Reply With Quote
Old 28th September 2007, 06:26   #5
Takhir
Major Dude
 
Join Date: Feb 2004
Location: Moscow, Russia
Posts: 1,222
Stderr capture is possible, but not in current release.
Takhir is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump