HADOOP-19011. Possible ConcurrentModificationException if Exec command fails (#6353)

This commit is contained in:
Doroszlai, Attila 2023-12-14 19:46:19 +01:00 committed by GitHub
parent 16edb4ac96
commit cf21f35526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,14 +72,14 @@ public int run(List<String> command, List<String> output,
stdOut.start(); stdOut.start();
stdErr.start(); stdErr.start();
retCode = p.waitFor(); retCode = p.waitFor();
stdOut.join();
stdErr.join();
if (retCode != 0) { if (retCode != 0) {
mojo.getLog().warn(command + " failed with error code " + retCode); mojo.getLog().warn(command + " failed with error code " + retCode);
for (String s : stdErr.getOutput()) { for (String s : stdErr.getOutput()) {
mojo.getLog().debug(s); mojo.getLog().debug(s);
} }
} }
stdOut.join();
stdErr.join();
output.addAll(stdOut.getOutput()); output.addAll(stdOut.getOutput());
if (errors != null) { if (errors != null) {
errors.addAll(stdErr.getOutput()); errors.addAll(stdErr.getOutput());