1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- Documenting T:NAnt.Core.Tasks.ExecTask-->
<head>
<meta http-equiv="Content-Language" content="en-ca" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="../style.css" />
<title><exec> Task</title>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="2" class="NavBar">
<tr>
<td class="NavBar-Cell">
<a href="http://nant.sourceforge.net">
<b>NAnt</b>
</a>
<img alt="->" src="../images/arrow.gif" />
<a href="../index.html">Help</a>
<img alt="->" src="../images/arrow.gif" />
<a href="../tasks/index.html">Task Reference</a>
<img alt="->" src="../images/arrow.gif" /> <exec></td>
<td class="NavBar-Cell" align="right">
v0.85</td>
</tr>
</table>
<h1><exec></h1>
<p> Executes a system command. </p>
<h3>Parameters</h3>
<div class="table">
<table>
<tr>
<th>Attribute</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
<th style="text-align: center;">Required</th>
</tr>
<tr>
<td valign="top" class="required">program</td>
<td style="text-align: center;">string</td>
<td> The program to execute without command arguments. </td>
<td style="text-align: center;">True</td>
</tr>
<tr>
<td valign="top">append</td>
<td style="text-align: center;">bool</td>
<td> Gets or sets a value indicating whether output should be appended to the output file. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">basedir</td>
<td style="text-align: center;">directory</td>
<td> The directory the program is in. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">commandline</td>
<td style="text-align: center;">string</td>
<td> The command-line arguments for the program. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">output</td>
<td style="text-align: center;">file</td>
<td> The file to which the standard output will be redirected. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">resultproperty</td>
<td style="text-align: center;">string</td>
<td>
<p> The name of a property in which the exit code of the program should be stored. Only of interest if <code>failonerror</code> is <b>false</b>. </p>
<p> If the exit code of the program is "-1000" then the program could not be started, or did not exit (in time). </p>
</td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">useruntimeengine</td>
<td style="text-align: center;">bool</td>
<td> Specifies whether the external program should be executed using a runtime engine, if configured. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">workingdir</td>
<td style="text-align: center;">directory</td>
<td> The directory in which the command will be executed. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">failonerror</td>
<td style="text-align: center;">bool</td>
<td> Determines if task failure stops the build, or is just reported. The default is <b>true</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">if</td>
<td style="text-align: center;">bool</td>
<td> If <b>true</b> then the task will be executed; otherwise, skipped. The default is <b>true</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">timeout</td>
<td style="text-align: center;">int</td>
<td> The maximum amount of time the application is allowed to execute, expressed in milliseconds. Defaults to no time-out. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">unless</td>
<td style="text-align: center;">bool</td>
<td> Opposite of <code>if</code>. If <b>false</b> then the task will be executed; otherwise, skipped. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">verbose</td>
<td style="text-align: center;">bool</td>
<td> Determines whether the task should report detailed build log messages. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
</table>
</div>
<h3>Framework-configurable parameters</h3>
<div class="table">
<table>
<tr>
<th>Attribute</th>
<th style="text-align: center;">Type</th>
<th>Description</th>
<th style="text-align: center;">Required</th>
</tr>
<tr>
<td valign="top">exename</td>
<td style="text-align: center;">string</td>
<td> The name of the executable that should be used to launch the external program. </td>
<td style="text-align: center;">False</td>
</tr>
<tr>
<td valign="top">useruntimeengine</td>
<td style="text-align: center;">bool</td>
<td> Specifies whether the external program should be executed using a runtime engine, if configured. The default is <b>false</b>. </td>
<td style="text-align: center;">False</td>
</tr>
</table>
</div>
<h3>Nested Elements:</h3>
<!--Element-->
<h4>
<a id="environment">
</a>
<environment>
</h4>
<div class="nested-element"> Environment variables to pass to the program. <p> A set of environment variables. </p><h3>Nested Elements:</h3><!--Array--><!--NestedElementArray=T:NAnt.Core.Types.Option--><h4><a id="option"></a>
<option>
</h4><div class="nested-element"><i>Deprecated.</i> Environment variable to pass to a program. <p> Represents an option. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> Name of the option. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the option should be passed to the task. If <b>true</b> then the option will be passed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the option should not be passed to the task. If <b>false</b> then the option will be passed; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">value</td><td style="text-align: center;">string</td><td> Value of the option. The default is a null reference (<b>Nothing</b> in Visual Basic). </td><td style="text-align: center;">False</td></tr></table></div></div><h4><a id="option"></a>
</option>
</h4><!--Array--><!--NestedElementArray=T:NAnt.Core.Types.EnvironmentVariable--><h4><a id="variable"></a>
<variable>
</h4><div class="nested-element"> Environment variable to pass to a program. <p> Represents an environment variable. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top" class="required">name</td><td style="text-align: center;">string</td><td> The name of the environment variable. </td><td style="text-align: center;">True</td></tr><tr><td valign="top">dir</td><td style="text-align: center;">directory</td><td> The value for a directory-based environment variable. NAnt will convert it to an absolute path. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">file</td><td style="text-align: center;">file</td><td> The value for a file-based environment variable. NAnt will convert it to an absolute filename. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the environment variable should be passed to the external program. If <b>true</b> then the environment variable will be passed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">path</td><td style="text-align: center;"><path></td><td> The value for a PATH like environment variable. You can use <code>:</code> or <code>;</code> as path separators and NAnt will convert it to the platform's local conventions. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the environment variable should not be passed to the external program. If <b>false</b> then the environment variable will be passed; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">value</td><td style="text-align: center;">string</td><td> The literal value for the environment variable. </td><td style="text-align: center;">False</td></tr></table></div><h3>Nested Elements:</h3><!--Element--><h4><a id="path"></a>
<<a href="../types/path.html">path</a>>
</h4><div class="nested-element"> Sets a single environment variable and treats it like a PATH - ensures the right separator for the local platform is used. <p /></div><h4><a id="path"></a>
</<a href="../types/path.html">path</a>>
</h4></div><h4><a id="variable"></a>
</variable>
</h4><p /></div>
<h4>
<a id="environment">
</a>
</environment>
</h4>
<!--Array-->
<!--NestedElementArray=T:NAnt.Core.Types.Argument-->
<h4>
<a id="arg">
</a>
<arg>
</h4>
<div class="nested-element"> The command-line arguments for the external program. <p> Represents a command-line argument. </p><h3>Parameters</h3><div class="table"><table><tr><th>Attribute</th><th style="text-align: center;">Type</th><th>Description</th><th style="text-align: center;">Required</th></tr><tr><td valign="top">dir</td><td style="text-align: center;">directory</td><td> The value for a directory-based command-line argument; will be replaced with the absolute path of the directory. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">file</td><td style="text-align: center;">file</td><td> The name of a file as a single command-line argument; will be replaced with the absolute filename of the file. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">if</td><td style="text-align: center;">bool</td><td> Indicates if the argument should be passed to the external program. If <b>true</b> then the argument will be passed; otherwise, skipped. The default is <b>true</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">line</td><td style="text-align: center;">string</td><td> List of command-line arguments; will be passed to the executable as is. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">path</td><td style="text-align: center;"><path></td><td> The value for a PATH-like command-line argument; you can use <code>:</code> or <code>;</code> as path separators and NAnt will convert it to the platform's local conventions, while resolving references to environment variables. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">unless</td><td style="text-align: center;">bool</td><td> Indicates if the argument should not be passed to the external program. If <b>false</b> then the argument will be passed; otherwise, skipped. The default is <b>false</b>. </td><td style="text-align: center;">False</td></tr><tr><td valign="top">value</td><td style="text-align: center;">string</td><td> A single command-line argument; can contain space characters. </td><td style="text-align: center;">False</td></tr></table></div><h3>Nested Elements:</h3><!--Element--><h4><a id="path"></a>
<<a href="../types/path.html">path</a>>
</h4><div class="nested-element"> Sets a single command-line argument and treats it like a PATH - ensures the right separator for the local platform is used. <p /></div><h4><a id="path"></a>
</<a href="../types/path.html">path</a>>
</h4><h3>Examples</h3><ul class="examples"><li><p> A single command-line argument containing a space character. </p><pre class="code">
<arg value="-l -a" />
</pre></li><li><p> Two separate command-line arguments. </p><pre class="code">
<arg line="-l -a" />
</pre></li><li><p> A single command-line argument with the value <code>\dir;\dir2;\dir3</code> on DOS-based systems and <code>/dir:/dir2:/dir3</code> on Unix-like systems. </p><pre class="code">
<arg path="/dir;/dir2:\dir3" />
</pre></li></ul></div>
<h4>
<a id="arg">
</a>
</arg>
</h4>
<h3>Examples</h3>
<ul class="examples">
<li>
<p>Ping "nant.sourceforge.net".</p>
<pre class="code">
<exec program="ping">
<arg value="nant.sourceforge.net" />
</exec>
</pre>
</li>
<li>
<p> Execute a java application using <code>IKVM.NET</code> that requires the Apache FOP jars, and a set of custom jars. </p>
<pre class="code">
<path id="fop-classpath">
<pathelement file="${fop.dist.dir}/build/fop.jar" />
<pathelement file="${fop.dist.dir}/lib/xercesImpl-2.2.1.jar" />
<pathelement file="${fop.dist.dir}/lib/avalon-framework-cvs-20020806.jar" />
<pathelement file="${fop.dist.dir}/lib/batik.jar" />
</path>
<exec program="ikvm.exe" useruntimeengine="true">
<arg value="-cp" />
<arg>
<path>
<pathelement dir="conf" />
<path refid="fop-classpath" />
<pathelement file="lib/mylib.jar" />
<pathelement file="lib/otherlib.zip" />
</path>
</arg>
<arg value="org.me.MyProg" />
</exec>
</pre>
<p> Assuming the base directory of the build file is "c:\ikvm-test" and the value of the "fop.dist.dir" property is "c:\fop", then the value of the <code>-cp</code> argument that is passed to<code>ikvm.exe</code> is "c:\ikvm-test\conf;c:\fop\build\fop.jar;conf;c:\fop\lib\xercesImpl-2.2.1.jar;c:\fop\lib\avalon-framework-cvs-20020806.jar;c:\fop\lib\batik.jar;c:\ikvm-test\lib\mylib.jar;c:\ikvm-test\lib\otherlib.zip" on a DOS-based system. </p>
</li>
</ul>
<h3>Requirements</h3>
<div style="margin-left: 20px;">
<b>Assembly:</b> NAnt.Core (0.85.2478.0)
</div>
</body>
</html>
|