[Image]
             - The External Ant Tool for Remote Method Invocation

 
 

 
 
 
[Image]
 
[Image]
 
[Image]


 
 
 

BackgroundExecTask

Wednesday, November 13, 2002

Description

Executes a system command in the background. When the os attribute is specified, then the command is only executed when Ant is run on one of the specified operating systems.

Parameters

Attribute Description Required
executable The command to execute without any command line arguments. Yes
id The unique identifier for the process.  Optional, only needed for management of process through the ProcessTask. No
dir The directory in which the command should be executed. No, default is current directory
os List of Operating Systems on which the command may be executed. If the current OS's name is contained in this list, the command will be executed. The OS's name is determined by the Java Virtual machine and is set in the "os.name" system property. No
startuptime The amount of time in milliseconds to wait after successfully spawning process for process startup time. No, default is zero
failifexecutionfails Stop the build if we can't start the program. Defaults to true. No, default is true
newenvironment Do not propagate old environment. No, default is false
vmlauncher Run command using the Java VM's execution facilities where available. If set to false the underlying OS's shell, either directly or through the antRun scripts, will be used. Under some operating systems, this gives access to facilities not normally available through the VM including, under Windows, being able to execute scripts, rather than their associated interpreter. If you want to specify the name of the executable as a relative path to the directory given by the dir attribute, it may become necessary to set vmlauncher to false as well. No, default is true
killonbuildend Destroy process upon build end or if VM terminates, which ever occurs first. No, default is true

Parameters specified as nested elements

arg

See the description of using command line arguments.

env

It is possible to specify environment variables to pass to the system command via nested <env> elements.

Attribute Description Required
key The name of the environment variable. Yes
value The literal value for the environment variable. Exactly one of these.
path The value for a PATH like environment variable. You can use ; or : as path separators and Ant will convert it to the platform's local conventions.
file The value for the environment variable. Will be replaced by the absolute filename of the file by Ant.

Example

  <taskdef name="background" classname="com.eatrmi.tools.ant.taskdefs.process.BackgroundExecTask"/>
  <taskdef name="proc" classname="com.eatrmi.tools.ant.taskdefs.process.ProcessTask"/>
  <background id="myexe" executable="myexe.exe" startuptime="10000">

<arg value="myarg"/>

</background>
<proc refid="myexe" destroy="true"/>

Starts the executable and then later destroys the spawned process.



Printer Friendly Version