From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-4.1 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id DF1101F56C for ; Sat, 2 Sep 2023 11:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=80x24.org; s=selector1; t=1693653001; bh=7uP9r63JUR0p328t4ZpOBTeb9huU1rCeituBL4Nbef8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=pi7BWD04QHvJVnj5uFsJMJGlwgbJjJiXW0eNGqSeMgFovqq9Cs4HOvI9tPLrGIcz1 ZpSH9qpECjLSoURq1o9IRCxy5ftOFIuQAV0hV/8nUq4OgIRF3PRBwxrL89sOaZrlSn DUm+HGEyWeBJuA50gstOjLKJOeYksuzw0fSb119g= From: Eric Wong To: spew@80x24.org Subject: [PATCH 10/10] special cases for unblocking signals Date: Sat, 2 Sep 2023 11:10:00 +0000 Message-ID: <20230902111000.1747604-10-e@80x24.org> In-Reply-To: <20230902111000.1747604-1-e@80x24.org> References: <20230902111000.1747604-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: --- lib/PublicInbox/TestCommon.pm | 5 +++-- t/lei-sigpipe.t | 3 ++- t/v2mirror.t | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/TestCommon.pm b/lib/PublicInbox/TestCommon.pm index b07c7957..1fd01bcb 100644 --- a/lib/PublicInbox/TestCommon.pm +++ b/lib/PublicInbox/TestCommon.pm @@ -475,7 +475,8 @@ sub start_script { } my $oset = PublicInbox::DS::block_signals(); require PublicInbox::OnDestroy; - my $restore = PublicInbox::OnDestroy->new($$, + my $restore = PublicInbox::OnDestroy->new( + $opt->{unblock_child} ? () : ($$), \&PublicInbox::DS::sig_setmask, $oset); my $pid = fork // die "fork: $!"; if ($pid == 0) { @@ -503,8 +504,8 @@ sub start_script { } if ($opt->{-C}) { chdir($opt->{-C}) or die "chdir: $!" } $0 = join(' ', @$cmd); + undef $restore; if ($sub) { - eval { PublicInbox::DS->Reset }; _run_sub($sub, $key, \@argv); POSIX::_exit($? >> 8); } else { diff --git a/t/lei-sigpipe.t b/t/lei-sigpipe.t index 55c208e2..fe986c68 100644 --- a/t/lei-sigpipe.t +++ b/t/lei-sigpipe.t @@ -39,7 +39,8 @@ EOM lei_ok(qw(import), $f) if $imported++ == 0; open my $errfh, '+>>', "$ENV{HOME}/stderr.log" or xbail $!; - my $opt = { run_mode => 0, 2 => $errfh, 1 => $w }; + my $opt = { run_mode => 0, 2 => $errfh, 1 => $w, + unblock_child => 1 }; my $cmd = [qw(lei q -q -t), @$out, 'z:1..']; my $tp = start_script($cmd, undef, $opt); close $w; diff --git a/t/v2mirror.t b/t/v2mirror.t index c1c66d45..2bc2b194 100644 --- a/t/v2mirror.t +++ b/t/v2mirror.t @@ -364,6 +364,7 @@ EOM open $rdr->{2}, '>>', "$tmpdir/plackup.err.log" or xbail "open: $!"; open $rdr->{1}, '>>&', $rdr->{2} or xbail "open: $!"; my $env = { PERL5LIB => 'lib', PERL_INLINE_DIRECTORY => undef }; + $rdr->{unblock_child} = 1; $td = start_script($cmd, $env, $rdr); # wait for plackup socket()+bind()+listen() my %opt = ( Proto => 'tcp', Type => Socket::SOCK_STREAM(),