Title: Exec program can't handle dir name with spaces

This is a command line issue.  You're essentially executing:

C:\>changes.cmd root branch tstamp > c:\builds\smc management center\logfiles\filename

 

So it's not reading the whole path for the pipe, just the "c:\builds\smc", and then another argument "management", at which point I guess it freaks out.

 

You should be able to fix this by putting quotes around it, so your command line is:

C:\>changes.cmd root branch tstamp > "c:\builds\smc management center\logfiles\filename"

 

To do this in your build file, try this:

                <exec program="${tools.bin.path}\changes.cmd"
                commandline="${cc.root} ${cc.branch} ${cc.last.published.view.tstamp} ${cc.current.view.tstamp} > &quot;${buildlog.dir}\${source.changes.log.filename}&quot;" failonerror="false"/>

 

Thanks,
Ryan


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kedziora, Rebecca
Sent: Thursday, November 03, 2005 10:55 AM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] Exec program can't handle dir name with spaces

 

A bug or not with nant .85 rc 3?

I am executing a program using the exec task as shown below:

                <exec program="${tools.bin.path}\changes.cmd"
                commandline="${cc.root} ${cc.branch} ${cc.last.published.view.tstamp} ${cc.current.view.tstamp} > ${buildlog.dir}\${source.changes.log.filename}" failonerror="false"/>

As you can see I am piping my output to a file using >.  The problem I am having is if the directory has spaces that is being piped too it will not create the ${source.changes.log.filename}.  For example if my ${buildlog.dir} directory is  c:\builds\smc management center\logfiles it will not work.  If I use c:\builds\smc\logfiles it will work.

The work around I did was to move the file after it was created.

                <move file="${project.workingdir}\${source.changes.log.filename}" todir="${buildlog.dir}" overwrite="true" failonerror="false"/>

Is this a bug?

-Rebecca

Reply via email to