<commit_before>#! perl -w
# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
# $Id$

=head1 NAME

t/pmc/signal.t - Signal Handling

=head1 SYNOPSIS

	% perl t/pmc/signal.t

=head1 DECSRIPTION

Tests signal handling. All test are skipped unless running on Linux.

=cut

use Parrot::Test;
use Test::More;
use strict;

my %platforms = map {$_=>1} qw/
    hpux
    linux
/;

if ($platforms{$^O}) {
    plan tests => 3 * 2;
}
else {
    plan skip_all => 'No events yet';
}

#
# A SIGINT is sent to parrot from the alarm handler
# This is a non-portable hack.

my $pid;

sub send_SIGINT {
    $SIG{ALRM} = sub {
	# get PID of parrot
	my @ps = `ps | grep [p]arrot`;
	die 'no output from ps' unless @ps;
	# the IO thread parrot process
	# on 2.2.x there are 4 processes, last is the IO thread
	my $io_thread = pop @ps;
	if ($io_thread =~ /^\s*(\d+)/) {
	    $pid = $1;
	    # send a SIGINT
	    kill 'SIGINT', $pid;
	}
	else {
	    die 'no pid found for parrot';
	}<commit_msg>use unix98 ps option - courtesy of <NAME><commit_after>#! perl -w
# Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
# $Id$

=head1 NAME

t/pmc/signal.t - Signal Handling

=head1 SYNOPSIS

	% perl t/pmc/signal.t

=head1 DECSRIPTION

Tests signal handling. All test are skipped unless running on Linux.

=cut

use Parrot::Test;
use Test::More;
use strict;

my %platforms = map {$_=>1} qw/
    hpux
    linux
/;

if ($platforms{$^O}) {
    plan tests => 3 * 2;
}
else {
    plan skip_all => 'No events yet';
}

#
# A SIGINT is sent to parrot from the alarm handler
# This is a non-portable hack.

my $pid;

sub send_SIGINT {
    $SIG{ALRM} = sub {
	# get PID of parrot
	my @ps = `ps -C parrot -o pid`;
	die 'no output from ps' unless @ps;
	# the IO thread parrot process
	# on 2.2.x there are 4 processes, last is the IO thread
	my $io_thread = pop @ps;
	if ($io_thread =~ /^\s*(\d+)/) {
	    $pid = $1;
	    # send a SIGINT
	    kill 'SIGINT', $pid;
	}
	else {
	    die 'no pid found for parrot';
	}
{'fraction_non_alphanumeric': 0.13219829744616926, 'fraction_numerical': 0.01902854281422133, 'mean_word_length': 2.8423076923076924, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6150106', 'n_tokens_mistral': 827, 'n_tokens_neox': 779, 'n_words': 278}