Return-Path: Delivered-To: apmail-ant-dev-archive@www.apache.org Received: (qmail 85054 invoked from network); 8 Feb 2005 18:51:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 8 Feb 2005 18:51:30 -0000 Received: (qmail 7533 invoked by uid 500); 8 Feb 2005 18:51:28 -0000 Delivered-To: apmail-ant-dev-archive@ant.apache.org Received: (qmail 7488 invoked by uid 500); 8 Feb 2005 18:51:27 -0000 Mailing-List: contact dev-help@ant.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Ant Developers List" Reply-To: "Ant Developers List" Delivered-To: mailing list dev@ant.apache.org Received: (qmail 7475 invoked by uid 500); 8 Feb 2005 18:51:27 -0000 Received: (qmail 7471 invoked by uid 99); 8 Feb 2005 18:51:27 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from minotaur.apache.org (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.28) with SMTP; Tue, 08 Feb 2005 10:51:27 -0800 Received: (qmail 85004 invoked by uid 1365); 8 Feb 2005 18:51:26 -0000 Date: 8 Feb 2005 18:51:26 -0000 Message-ID: <20050208185126.85003.qmail@minotaur.apache.org> From: stevel@apache.org To: ant-cvs@apache.org Subject: cvs commit: ant/src/main/org/apache/tools/ant/taskdefs/optional Rpm.java X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N stevel 2005/02/08 10:51:26 Modified: src/main/org/apache/tools/ant/taskdefs/optional Rpm.java Log: return code checking on rpm. How do we test this? Revision Changes Path 1.23 +9 -15 ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java Index: Rpm.java =================================================================== RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/optional/Rpm.java,v retrieving revision 1.22 retrieving revision 1.23 diff -u -r1.22 -r1.23 --- Rpm.java 9 Mar 2004 16:48:15 -0000 1.22 +++ Rpm.java 8 Feb 2005 18:51:26 -0000 1.23 @@ -27,6 +27,7 @@ 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 @@ 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); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org For additional commands, e-mail: dev-help@ant.apache.org