]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
spawn: remove non-blocking support, here
authorEric Wong <e@80x24.org>
Mon, 26 Dec 2016 09:58:02 +0000 (09:58 +0000)
committerEric Wong <e@80x24.org>
Mon, 26 Dec 2016 10:06:14 +0000 (10:06 +0000)
It is never used, and inappropriate to support in generic code.

HTTPD::Async already sets non-blocking, and it's better to do it
in -httpd-specific code since we know our -httpd can handle it.

lib/PublicInbox/Spawn.pm
t/spawn.t

index 41b08a33e9b2aa512d5eff91109c791569f5b849..e543be54f827a234a77edbc9f2713134b784b4b7 100644 (file)
@@ -190,8 +190,6 @@ sub popen_rd {
        my ($cmd, $env, $opts) = @_;
        pipe(my ($r, $w)) or die "pipe: $!\n";
        $opts ||= {};
-       my $blocking = $opts->{Blocking};
-       IO::Handle::blocking($r, $blocking) if defined $blocking;
        $opts->{1} = fileno($w);
        my $pid = spawn($cmd, $env, $opts);
        return unless defined $pid;
index 0f756462d02999831eff5307a87a8312acc419ca..2dcdf883420784afc13d275f4a152ec1213b7dbd 100644 (file)
--- a/t/spawn.t
+++ b/t/spawn.t
@@ -81,17 +81,6 @@ use PublicInbox::Spawn qw(which spawn popen_rd);
        isnt($?, 0, '$? set properly: '.$?);
 }
 
-{
-       my ($fh, $pid) = popen_rd([qw(sleep 60)], undef, { Blocking => 0 });
-       ok(defined $pid && $pid > 0, 'returned pid when array requested');
-       is(kill(0, $pid), 1, 'child process is running');
-       ok(!defined(sysread($fh, my $buf, 1)) && $!{EAGAIN},
-          'sysread returned quickly with EAGAIN');
-       is(kill(9, $pid), 1, 'child process killed early');
-       is(waitpid($pid, 0), $pid, 'child process reapable');
-       isnt($?, 0, '$? set properly: '.$?);
-}
-
 done_testing();
 
 1;