Ticket #279: process-quarantine.patch
| File process-quarantine.patch, 1.7 kB (added by jnorell, 6 years ago) |
|---|
-
process-quarantine.pl
old new 164 164 push(@cl_array, "--ham-only") if ($hamonly); # process ham only 165 165 push(@cl_array, "--debug") if ($debug); # turn on debugging mode 166 166 push(@cl_array, "--quiet") if ($quiet); # turn on quiet mode 167 push(@cl_array, "|| /bin/echo \"DIED: \$?\""); # hacked exit status reporter 168 169 my $cl_command = join(' ', @cl_array); 167 170 168 171 # Call the subroutine until there are no items left to process 169 172 my $total_items_processed = 0; 170 173 my $total_processing_runs = 0; 171 174 my $items_processed = -1; 172 175 while ($items_processed != 0) { 173 $items_processed = system(@cl_array) / 256; 176 $items_processed = 0; 177 open(CL, "$cl_command |") || die "can't run subroutine: $!\n"; 178 while (chomp(my $clout = <CL>)) { 179 if ($clout =~ m/^DIED: (\d)+/) { 180 $clout =~ s/^DIED: //; 181 die "subroutine died with error status $clout"; 182 } elsif ($clout =~ m/^(\d)+/) { 183 $items_processed .= $clout; 184 } else { 185 print "$clout\n"; 186 } 187 } 188 close(CL); 174 189 $total_items_processed += $items_processed; 175 190 $total_processing_runs++; 176 191 if ($debug) { -
process-quarantine-sub.pl
old new 111 111 { 112 112 my ($msg) = @_; 113 113 114 print $msg . "\n";114 print STDERR $msg . "\n"; 115 115 exit 0; 116 116 } 117 117 … … 558 558 # Disconnect from the database 559 559 $dbh->disconnect; 560 560 561 # We're done, return the total number of items processed. 562 exit ($spamcount + $hamcount); 561 # We're done, print the total number of items processed and return. 562 print ($spamcount + $hamcount); 563 exit(0);

