Greetings all

 

I am having a problem with passing environment variables to an exec task. Basically I am trying to convert what we do using regular .bat files to a NAnt equivalent.

 

I am using a nightly build of NAnt v0.85-20041006

Platform: Win2000 server sp4

 

 Here is an example of what I am using. All properties are set in a global context.

 

<property name="gnupath" value="d:\apps\cygwin\bin" />

.

.

.

 

<exec program="make.exe" basedir="${gnupath}" workingdir="${make.working.dir}/" >

<arg line="${make.cmd}" />

<environment>

<option name="ROOT_DRIVE" value="${apps.drive}" />

<option name="APPS_DIR" value="${apps.dir}" />

<option name="APPS_PATH" value="${apps.path}" />

<option name="UTILROOT" value="${utilpath}" />

.

.

</environment>

</exec>

 

After running the above, compilation fails. To troubleshoot I ran “set” from the command line to see if the environment variables have actually been set, they are not.. So I assume NAnt passes the environment for the instance of the exec task. To verify this I ran the .bat file from an exec task without the nested <environment> task

 

For example:  <exec program="mybatfile.bat" />

 

and included the environment variables within the batch file. i.e. “set GNUPATH=%APPS_PATH%\cygwin\bin” etc…

 

Compilation still fails, so verified the environment variables again using “set”… to my surprise GNUPATH is still not set in the environment. ???

 

I verified my bat file and it works fine if I don’t use NAnt. Could this be a bug or am I doing something wrong using in my Nant configuration?

 

 

 

Shawn Haigh


 

Reply via email to