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

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Sat Oct 24 23:01:34 CEST 2009


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 <holger at zedat.fu-berlin.de>

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.




More information about the Commits mailing list