Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
*/
package org.apache.maven.shared.utils.cli;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.ArrayList;
Expand Down Expand Up @@ -274,27 +275,26 @@ public Integer call() throws CommandLineException {

int returnValue = p.waitFor();

// TODO Find out if waitUntilDone needs to be called using a try-finally construct. The method may
// throw an
// InterruptedException so that calls to waitUntilDone may be skipped.
// try
// {
// if ( inputFeeder != null )
// {
// inputFeeder.waitUntilDone();
// }
// }
// finally
// {
// try
// {
// outputPumper.waitUntilDone();
// }
// finally
// {
// errorPumper.waitUntilDone();
// }
// }
// Close the process streams to work around JDK-4311711:
// Process.getInputStream().read() can hang indefinitely
// even after the process has terminated. Closing the
// streams causes the pumpers' readLine() calls to return.
try {
p.getOutputStream().close();
} catch (IOException e) {
// ignore
}
try {
p.getInputStream().close();
} catch (IOException e) {
// ignore
}
try {
p.getErrorStream().close();
} catch (IOException e) {
// ignore
}

if (inputFeeder != null) {
inputFeeder.waitUntilDone();
}
Expand Down
Loading