Changeset 1911

Show
Ignore:
Timestamp:
12/12/06 06:52:53
Author:
miyagawa
Message:

Filter::Pipe: support buffered command by calling finish() early, via http://mono.kmc.gr.jp/~yhara/d/?date=20061211#p02

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/Pipe.pm

    r1734 r1911  
    55use Encode; 
    66use HTML::Entities; 
    7 use IPC::Run qw( start pump finish timeout ); 
     7use IPC::Run qw( start timeout ); 
    88use Text::ParseWords qw(shellwords); 
    99 
     
    3030        my $body = $self->$meth($args->{entry}->body, $h, \$in, \$out); 
    3131        $args->{entry}->body( $body ); 
    32         $h->finish; 
    3332 
    3433        alarm 0; 
     
    5049    $$in_ref .= encode($self->conf->{encoding}, $body); 
    5150    $h->pump while $$in_ref; 
     51    $h->finish; 
    5252    $h->pump until $$out_ref; 
    5353 
  • trunk/plagger/t/plugins/Filter-Pipe/base.t

    r1472 r1911  
    1010 
    1111plan 'no_plan'; 
    12 run_eval_expected
     12run_eval_expected_with_capture
    1313 
    1414__END__ 
     
    5454close FH; 
    5555unlink $main::tmp; 
     56 
     57=== Testing buffered output 
     58--- input config 
     59plugins: 
     60  - module: Subscription::Config 
     61    config: 
     62      feed: 
     63        - file://$t::TestPlagger::BaseDirURI/t/samples/rss-full.xml 
     64 
     65  - module: Filter::Pipe 
     66    config: 
     67      command: ruby -e 'print \$stdin.read' 
     68      encoding: utf8 
     69      text_only: 1 
     70--- expected 
     71unlike $warnings, qr/timeout/, "no timeout"; 
     72