chiark / gitweb /
Merge branch 'master' of /u/webstump/live/
[modbot-mtm.git] / stump / bin / acceptFromMod.pl
index 9927f5cf9ab8b203b24a1a2b8a9d8df315f3a9e5..cfc937199d473fddba11448c14331f248b79c725 100755 (executable)
@@ -50,6 +50,7 @@ while( <STDIN> ) {
       $MessageNumber =~ s/^.*::$Prefix\///;
       $MessageNumber =~ /(\d+)/;
       $MessageNumber = $1;
+      $ENV{'WEBSTUMP_MESSAGENUM'}= $MessageNumber;
 
       $MessageFile = "$MNG_ROOT/tmp/messages/$MessageNumber";
  
@@ -130,21 +131,22 @@ while( <> ) {
 }
 
 print STDERR "Comment is: $comment\n" if( $comment );
+print STDERR "Signal handling for SIGPIPE: $SIG{PIPE}.\n";
 
 $ENV{'EXPLANATION'} = $comment;
 
 open( COMMAND, "| $command" ) ||  &processError( "$command failed" );
 
   open( MESSAGE, "$MessageFile" ) || &processError( "Can't open $MessageFile" );
-  print COMMAND while( <MESSAGE> );
-  close( MESSAGE );
+  while( <MESSAGE> ) { print COMMAND or die $!; }
+  close( MESSAGE ) or die "$? $!";
 
 #  if( $comment && !($command =~ '^processRejected') ) {
 #    print COMMAND 
 #       "\n======================================= MODERATOR'S COMMENT: \n" .
 #       $comment;
 #  }
-#close( COMMAND );
+close( COMMAND ) or die "$command $? $!";
 
 &processError( "No action specified" ) 
   if( $done ne "yes" );