ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Steve Loughran" <stev...@iseran.com>
Subject exec timeouts
Date Wed, 28 Nov 2001 08:12:08 GMT
It seems to me that although the execute watchdog works very well (I know,
I've reused in personal code), the Execution code isnt actually checking for
a failure

Take a task which needs a sleep command to hand

  <target name="sleep fifteen seconds" >
    <echo message="sleeping for 15 seconds" />
    <exec executable="sleep"
      failonerror="false"
      timeout="2000">
      <arg value="15" />
    </exec>
  </target>

Run this in verbose mode, optionally with a version of ExecuteWatchdog which
prints something when it wakes up

sleep fifteen seconds:
     [echo] sleeping for 15 seconds
     [exec] Current OS is Windows 2000
     [exec] sleep 15
timeout: killing process
     [exec] Result: 1

The task does notice the return value is set, but this is really some
artifact of how the runtime responds to process.getExitValue() once the
process has been destroyed; it isn't a real return code.

As it stands, if failonerror=true then the exception will be thrown,
provided sun dont change that behaviour of java.lang.Process, which is
unlikely. I could add a better warning message in ExecTask to indicate that
the timeout kicked in, and doc the behavior.

Seem reasonable?









--
To unsubscribe, e-mail:   <mailto:ant-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-dev-help@jakarta.apache.org>


Mime
View raw message