Browse Source

Move Process stream closure into a new public static method,

closeStreams(Process).
PR: 28565


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276419 13f79535-47bb-0310-9956-ffa450edef68
master
Matthew Jason Benson 21 years ago
parent
commit
c25de77022
1 changed files with 20 additions and 7 deletions
  1. +20
    -7
      src/main/org/apache/tools/ant/taskdefs/Execute.java

+ 20
- 7
src/main/org/apache/tools/ant/taskdefs/Execute.java View File

@@ -475,6 +475,7 @@ public class Execute {
watchdog.stop(); watchdog.stop();
} }
streamHandler.stop(); streamHandler.stop();
closeStreams(process);


if (watchdog != null) { if (watchdog != null) {
watchdog.checkException(); watchdog.checkException();
@@ -536,13 +537,6 @@ public class Execute {
setExitValue(process.exitValue()); setExitValue(process.exitValue());
} catch (InterruptedException e) { } catch (InterruptedException e) {
process.destroy(); process.destroy();
} finally {
try {
process.getInputStream().close();
process.getOutputStream().close();
process.getErrorStream().close();
} catch (IOException eyeOhEx) {
}
} }
} }


@@ -659,6 +653,25 @@ public class Execute {
} }
} }


/**
* Close the streams belonging to the given Process.
* @param process the <CODE>Process</CODE>.
*/
public static void closeStreams(Process process) {
try {
process.getInputStream().close();
} catch (IOException eyeOhEx) {
}
try {
process.getOutputStream().close();
} catch (IOException eyeOhEx) {
}
try {
process.getErrorStream().close();
} catch (IOException eyeOhEx) {
}
}

/** /**
* This method is VMS specific and used by getProcEnvironment(). * This method is VMS specific and used by getProcEnvironment().
* *


Loading…
Cancel
Save