Changeset 274
- Timestamp:
- 11/22/06 03:20:29 (6 years ago)
- Files:
-
- 2 modified
-
engines/dog (modified) (4 diffs)
-
status (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
engines/dog
r267 r274 3 3 my $myprogname = 'dog'; 4 4 my $progname = 'shepherd'; 5 my $version = '0.3.1 0';5 my $version = '0.3.11'; 6 6 7 7 # 'dog' … … 250 250 printf "SHEPHERD: Excuting command: $comm\n"; 251 251 chdir "$CWD/grabbers/$grabber/"; 252 $retval = call_prog($comm );252 $retval = call_prog($comm,(query_config($grabber,'max_runtime')*60)); 253 253 chdir $CWD; 254 254 } … … 1387 1387 my $dir = sprintf "%s/%ss/%s/",$CWD,$data_processor_type,$data_processor_name; 1388 1388 chdir $dir; 1389 my $retval = call_prog($comm );1389 my $retval = call_prog($comm,(query_config($grabber,'max_runtime')*60)); 1390 1390 chdir $CWD; 1391 1391 … … 1584 1584 sub call_prog 1585 1585 { 1586 my $prog = shift; 1586 my ($prog,$timeout) = @_; 1587 $timeout = 0 if (!defined $timeout); 1588 1587 1589 if (!(open(PROG,"$prog|"))) { 1588 1590 printf "warning: couldn't exec \"$prog\": $!\n"; 1589 1591 return -1; 1590 1592 } 1591 while(<PROG>) { 1592 print $_; 1593 } 1594 close(PROG); 1593 1594 eval { 1595 local $SIG{ALRM}; 1596 if ($timeout > 0) { 1597 $SIG{ALRM} = sub { die "alarm\n" }; 1598 alarm $timeout; # set alarm 1599 } 1600 while(<PROG>) { 1601 print $_; 1602 } 1603 alarm(0) if ($timeout > 0); # cancel alarm 1604 close(PROG); 1605 }; 1606 if ($@) { 1607 die unless $@ eq "alarm\n"; # propagate unexpected errors 1608 1609 # timeout 1610 printf "prog ran for $timeout seconds, stopping it.\n"; 1611 close(PROG); 1612 } 1595 1613 1596 1614 if ($? == -1) { -
status
r272 r274 1 1 application shepherd 0.3.22 2 engine dog 0.3.1 02 engine dog 0.3.11 3 3 grabber yahoo7widget 1.58-r1 4 4 grabber rex 3.3.7
