exec

Description

Execute an external program. This job will flag complete if the return state of the external program is 0, otherwise it will flag not complete.

Processes may behave differently on different operating systems - for instance stop doesn't alway kill the process. Please see http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4109888 for addtional information.

Properties

NameDescriptionRequired
name A name, can be any text. No.
dir The working directory. No
command The command to run. yes, unless arg elements are used instead.
args A string list of arguments. No.
env An environment variable to be set before the program is executed. This is a map like property. No.
stdin An input stream which will act as stdin for the process. No.
stdout An output to where stdout for the process will be written. No.
stderr An output to where stderr of the proces will be written. No.

Example

 <exec name="Batch Example">
   <args>
     <value value="cmd"/>
     <value value="/C"/>
     <value value="${oddjob.dir}\bin\greeting.bat"/>
     <value value="Hello"/>
   </args>
 </exec>
 

The example has the existing environement with an additional environment variable.

 <exec name="Example With Environment"
          command="foo.exe">
   <environment>
     <environment command="set" />
     <value name="ODDJOB_FILE" value="myfile.txt" />
   </environment>
 </exec>
 

Using the output of one process as the input of another.

 <sequential>
   <exec name='One' id='one' command='cmd /c echo hello'>
     <stdout>
       <buffer/>
     </stdout>
   </exec>
   <exec name='Two' id='two' command='c:/cygwin/bin/cat'
            stdin='${one.stdout}'/>
 </sequential>
    


(c) Rob Gordon 2005