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.
environment An environment variable to be set before the program is executed. This is a MapType 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.
newEnvironment Create a fresh/clean environment. No.
redirectStderr Redirect the standard error stream in standard output. No.

Example

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

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

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

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

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


(c) Rob Gordon 2005 - 2009