summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2009-10-24 20:55:44 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2009-10-24 20:55:44 (GMT)
commit61f2cebae3baabb2ae895f212ce089ff15cc37d2 (patch)
tree45816afcd29fae37127dcb795c63091059ac6275 /tools
parent85512d7f111e9b05446a012567f76472f5d5410c (diff)
downloadmonitoring-plugins-61f2cebae3baabb2ae895f212ce089ff15cc37d2.tar.gz
git-notify: Check the exit status of pipes
Properly check the exit status of all processes we execute and abort on error.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/git-notify10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/git-notify b/tools/git-notify
index b10b1bc..4a0faa5 100755
--- a/tools/git-notify
+++ b/tools/git-notify
@@ -309,7 +309,7 @@ sub mail_notification($$$@)
309 } 309 }
310 binmode MAIL, ":utf8"; 310 binmode MAIL, ":utf8";
311 print MAIL join("\n", @text), "\n"; 311 print MAIL join("\n", @text), "\n";
312 close MAIL; 312 close MAIL or die $! ? "Cannot execute $mailer: $!" : "$mailer exited with status: $?";
313 } 313 }
314} 314}
315 315
@@ -350,7 +350,7 @@ sub get_object_info($)
350 $info{$1 . "_tz"} = $6; 350 $info{$1 . "_tz"} = $6;
351 } 351 }
352 } 352 }
353 close OBJ; 353 close OBJ or die $! ? "Cannot execute cat-file: $!" : "cat-file exited with status: $?";
354 354
355 $info{"log"} = \@log; 355 $info{"log"} = \@log;
356 return %info; 356 return %info;
@@ -388,7 +388,7 @@ sub send_commit_notice($$)
388 388
389 open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; 389 open DIFF, "-|" or exec "git", "diff-tree", "-p", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
390 my $diff = join("", <DIFF>); 390 my $diff = join("", <DIFF>);
391 close DIFF; 391 close DIFF or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
392 392
393 return if length($diff) == 0; 393 return if length($diff) == 0;
394 394
@@ -419,7 +419,7 @@ sub send_commit_notice($$)
419 419
420 open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree"; 420 open STAT, "-|" or exec "git", "diff-tree", "--stat", "-M", "--no-commit-id", $obj or die "cannot exec git-diff-tree";
421 push @notice, join("", <STAT>); 421 push @notice, join("", <STAT>);
422 close STAT; 422 close STAT or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
423 423
424 if (($max_diff_size == -1) || (length($diff) < $max_diff_size)) 424 if (($max_diff_size == -1) || (length($diff) < $max_diff_size))
425 { 425 {
@@ -479,7 +479,7 @@ sub send_cia_notice($$)
479 push @cia_text, " <file action=\"rename\" to=\"" . xml_escape($new) . "\">" . xml_escape($old) . "</file>"; 479 push @cia_text, " <file action=\"rename\" to=\"" . xml_escape($new) . "\">" . xml_escape($old) . "</file>";
480 } 480 }
481 } 481 }
482 close COMMIT; 482 close COMMIT or die $! ? "Cannot execute diff-tree: $!" : "diff-tree exited with status: $?";
483 483
484 push @cia_text, 484 push @cia_text,
485 " </files>", 485 " </files>",