File: 34tickit-signal.t

package info (click to toggle)
libtickit-perl 0.73-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 660 kB
  • sloc: perl: 4,944; makefile: 5
file content (31 lines) | stat: -rw-r--r-- 508 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/perl

use v5.14;
use warnings;

use Test::More;

use Tickit qw( RUN_NOHANG );
use POSIX ();

pipe my( $term_rd, $my_wr ) or die "Cannot pipepair - $!";
pipe my( $my_rd, $term_wr ) or die "Cannot pipepair - $!";

my $tickit = Tickit->new(
   term_in  => $term_rd,
   term_out => $term_wr,
);

# signal
{
   my $caught;
   $tickit->watch_signal( POSIX::SIGHUP(), sub { $caught++ } );

   kill HUP => $$;

   $tickit->tick( 0 );

   is( $caught, 1, '$caught 1 after raise SIGHUP' );
}

done_testing;