Browse Source

Make sure the watched process is running before we kill it.

Submitted by:	Stephane Bailliez <sbailliez@imediation.com>


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268548 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
a6c64aa166
1 changed files with 15 additions and 5 deletions
  1. +15
    -5
      src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java

+ 15
- 5
src/main/org/apache/tools/ant/taskdefs/ExecuteWatchdog.java View File

@@ -147,11 +147,21 @@ public class ExecuteWatchdog implements Runnable {
wait(until - now); wait(until - now);
} catch (InterruptedException e) {} } catch (InterruptedException e) {}
} }
// if we are here, either someone stopped the watchdog or we are on timeout
// if watch is true, it means its a timeout
if (watch) {
killedProcess = true;
process.destroy();

// if we are here, either someone stopped the watchdog,
// we are on timeout and the process must be killed, or
// we are on timeout and the process has already stopped.
try {
// We must check if the process was not stopped
// before being here
process.exitValue();
} catch (IllegalThreadStateException e){
// the process is not terminated, if this is really
// a timeout and not a manual stop then kill it.
if (watch){
killedProcess = true;
process.destroy();
}
} }
} catch(Exception e) { } catch(Exception e) {
caught = e; caught = e;


Loading…
Cancel
Save