File: local-SIG.t

package info (click to toggle)
libcgi-compile-perl 0.27-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 248 kB
  • sloc: perl: 372; makefile: 2
file content (23 lines) | stat: -rw-r--r-- 483 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!perl

use Capture::Tiny 'capture_stdout';
use CGI::Compile;
use POSIX qw(:signal_h);

use Test::More $^O eq 'MSWin32' ? (
    skip_all => 'not supported on Win32') 
: (
    tests => 1
);

unless (defined sigprocmask(SIG_UNBLOCK, POSIX::SigSet->new(SIGQUIT))) {
    die "Could not unblock SIGQUIT\n";
}

my $sub = CGI::Compile->compile(\<<'EOF');
$SIG{QUIT} = sub{print "QUIT\n"};
kill QUIT => $$;
print "END\n";
EOF

is capture_stdout { $sub->() }, "QUIT\nEND\n", 'caught signal';