diff --git a/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java b/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java index 5c0307c5..ee676901 100644 --- a/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java +++ b/src/main/java/org/apache/maven/shared/utils/cli/CommandLineUtils.java @@ -274,34 +274,18 @@ 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(); - // } - // } - if (inputFeeder != null) { - inputFeeder.waitUntilDone(); + try { + if (inputFeeder != null) { + inputFeeder.waitUntilDone(); + } + } finally { + try { + outputPumper.waitUntilDone(); + } finally { + errorPumper.waitUntilDone(); + } } - outputPumper.waitUntilDone(); - errorPumper.waitUntilDone(); - if (inputFeeder != null && inputFeeder.getException() != null) { throw new CommandLineException("Failure processing stdin.", inputFeeder.getException()); }