SF.net SVN: nagiosplug:[2272] nagiosplug/trunk/tools/git-notify

[email protected]
Newsgroups gmane.network.nagios.plugins.cvs
Message-ID <[email protected]>
Revision: 2272
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2272&view=rev
Author:   dermoth
Date:     2009-10-24 21:01:34 +0000 (Sat, 24 Oct 2009)

Log Message:
-----------
git-notify: Check the exit status of pipes

Properly check the exit status of all processes we execute and abort on
error.

From: Holger Weiss <[email protected]>

Modified Paths:
--------------
    nagiosplug/trunk/tools/git-notify

Modified: nagiosplug/trunk/tools/git-notify
===================================================================
--- nagiosplug/trunk/tools/git-notify	2009-10-24 21:01:24 UTC (rev 2271)
+++ nagiosplug/trunk/tools/git-notify	2009-10-24 21:01:34 UTC (rev 2272)
@@ -309,7 +309,7 @@
         }
         binmode MAIL, ":utf8";
         print MAIL join("\n", @text), "\n";
-        close MAIL;
+        close MAIL or die $! ? "Cannot execute $mailer: $!" : "$mailer exited with status: $?";
     }
 }
 
@@ -350,7 +350,7 @@
             $info{$1 . "_tz"} = $6;
         }
     }
-    close OBJ;
+    close OBJ or die $! ? "Cannot execute cat-file: $!" : "cat-file exited with status: $?";
 
     $info{"log"} = \@log;
     return %info;
@@ -388,7 +388,7 @@
 
     open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
     my $diff = join("", <DIFF>);
-    close DIFF;
+    close DIFF or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
 
     return if length($diff) == 0;
 
@@ -419,7 +419,7 @@
 
     open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
     push @notice, join("", <STAT>);
-    close STAT;
+    close STAT or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
 
     if (($max_diff_size == -1) || (length($diff) < $max_diff_size))
     {
@@ -479,7 +479,7 @@
             push @cia_text, "        <file action=\"rename\" to=\"" . xml_escape($new) . "\">" . xml_escape($old) . "</file>";
         }
     }
-    close COMMIT;
+    close COMMIT or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
 
     push @cia_text,
         "      </files>",


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.