From: Tyler Riddle Date: Fri, 30 Nov 2012 21:52:33 +0000 (-0800) Subject: move PIPE signal handler to miniloop and update timeout param in t/timeout.t to match... X-Git-Tag: v0.003001_01~54 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e1a0b9ca22fab8555fb597473b6f3a4074d7b48b;p=scpubgit%2FObject-Remote.git move PIPE signal handler to miniloop and update timeout param in t/timeout.t to match previous API change; all tests are now passing --- diff --git a/lib/Object/Remote/Connection.pm b/lib/Object/Remote/Connection.pm index 66d4c2e..7d64071 100644 --- a/lib/Object/Remote/Connection.pm +++ b/lib/Object/Remote/Connection.pm @@ -18,10 +18,7 @@ use JSON::PP qw(encode_json); use Moo; use Carp qw(croak); -BEGIN { - router()->exclude_forwarding; - $SIG{PIPE} = sub { log_debug { "Got a PIPE signal" } }; -} +BEGIN { router()->exclude_forwarding } END { log_debug { "Killing all child processes in the process group" }; diff --git a/lib/Object/Remote/MiniLoop.pm b/lib/Object/Remote/MiniLoop.pm index cf572d6..8465c96 100644 --- a/lib/Object/Remote/MiniLoop.pm +++ b/lib/Object/Remote/MiniLoop.pm @@ -5,7 +5,11 @@ use Time::HiRes qw(time); use Object::Remote::Logging qw( :log :dlog router ); use Moo; -BEGIN { router()->exclude_forwarding } +BEGIN { + $SIG{PIPE} = sub { log_debug { "Got a PIPE signal" } }; + + router()->exclude_forwarding +} # this is ro because we only actually set it using local in sub run has is_running => (is => 'ro', clearer => 'stop'); diff --git a/t/timeout.t b/t/timeout.t index c205b93..3b208d7 100644 --- a/t/timeout.t +++ b/t/timeout.t @@ -7,7 +7,7 @@ use Object::Remote; use Object::Remote::Connector::Local; my $connector = Object::Remote::Connector::Local->new( - timeout => { after => 0.1 }, + timeout => 0.1, perl_command => [ 'perl', '-e', 'sleep 3' ], );