Browse Source

return code checking on rpm. How do we test this?

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277619 13f79535-47bb-0310-9956-ffa450edef68
master
Steve Loughran 20 years ago
parent
commit
76cb3597bd
1 changed files with 9 additions and 15 deletions
  1. +9
    -15
      src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java

+ 9
- 15
src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java View File

@@ -27,6 +27,7 @@ import java.util.Vector;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
import org.apache.tools.ant.util.FileUtils;
import org.apache.tools.ant.taskdefs.Execute;
import org.apache.tools.ant.taskdefs.ExecuteStreamHandler;
import org.apache.tools.ant.taskdefs.LogOutputStream;
@@ -161,25 +162,18 @@ public class Rpm extends Task {

exe.setCommandline(toExecute.getCommandline());
try {
exe.execute();
log("Building the RPM based on the " + specFile + " file");
int returncode = exe.execute();
if (returncode != 0) {
throw new BuildException("'" +
toExecute.getExecutable() +
"' failed with exit code "+returncode);
}
} catch (IOException e) {
throw new BuildException(e, getLocation());
} finally {
if (output != null) {
try {
outputstream.close();
} catch (IOException e) {
// ignore any secondary error
}
}
if (error != null) {
try {
errorstream.close();
} catch (IOException e) {
// ignore any secondary error
}
}
FileUtils.close(outputstream);
FileUtils.close(errorstream);
}
}



Loading…
Cancel
Save