$SIG
{CHLD} =
sub
{
wait
;};
my
(
$got
,
$field
);
my
$t
= Proc::ProcessTable->new;
foreach
$got
( @{
$t
->table} )
{
next
unless
$got
->pid == $$;
print
STDERR
"--------------------------------\n"
;
foreach
$field
(
$t
->fields){
my
$v
=
$got
->{
$field
};
if
(
ref
(
$v
) eq
"ARRAY"
)
{
$v
=
"\""
.
join
(
"\",\""
,
@$v
) .
"\""
;
}
print
STDERR
$field
,
": "
, (
defined
$v
?
$v
:
"<undef>"
),
"\n"
;
}
}
plan
skip_all
=>
'This test needs real fork() implementation'
if
$Config
{d_pseudofork} || !
$Config
{d_fork};
plan
tests
=> 3;
my
$child_pid
=
fork
;
if
(
$child_pid
)
{
foreach
$got
( @{
$t
->table} )
{
if
(
$got
->pid ==
$child_pid
)
{
ok(1);
if
(
$got
->
kill
(9) )
{
ok(1);
}
else
{
ok(0);
kill
9,
$child_pid
;
exit
-1;
}
sleep
2;
foreach
$got
( @{
$t
->table} )
{
if
(
$got
->pid ==
$child_pid
)
{
ok(0);
kill
9,
$child_pid
;
exit
-1;
}
}
ok(1);
exit
0;
}
}
ok(0);
exit
-1;
}
else
{
sleep
10;
}