Skip to content

Commit a4f231d

Browse files
authored
Merge pull request #71 from perlpunk/fix-test
t: Use $^X for executing perl
2 parents 2d608a1 + 7cfeea9 commit a4f231d

2 files changed

Lines changed: 10 additions & 18 deletions

File tree

.proverc

Lines changed: 0 additions & 2 deletions
This file was deleted.

t/01_run.t

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ subtest stop_whole_process_group_gracefully => sub {
497497
code => sub {
498498
$SIG{TERM} = 'IGNORE';
499499
setpgrp(0, 0);
500-
exec(perl => $test_script);
500+
exec($^X => $test_script);
501501
})->start();
502502

503503
# wait until the sub process changes its process group
@@ -641,22 +641,16 @@ subtest 'SIG_CHLD handler in spawned process' => sub {
641641
my $simple_rwp = check_bin("$FindBin::Bin/data/simple_rwp.pl");
642642
my $sigchld_handler = check_bin("$FindBin::Bin/data/sigchld_handler.pl");
643643

644-
# use `perl <script>` here, as Github ci action place the used perl executable
645-
# somewhere like /opt/hostedtoolcache/perl/<version>/<arch>/bin/perl so
646-
# /usr/bin/perl wouldn't have all needed dependencies
647-
is(
648-
process(execute => 'perl')
649-
->args([$simple_rwp])
650-
->start()
651-
->wait_stop()
652-
->exit_status(),
653-
0,
654-
'simple_rwp.pl exit with 0'
655-
);
644+
# use `$^X <script>` here, to make sure we run the same perl as the test
645+
# was started with
646+
my $p = process(execute => $^X)->args([$simple_rwp])->start->wait_stop;
647+
is $p->exit_status(), 0, 'simple_rwp.pl exit with 0';
656648

657-
my $p = process(execute => $sigchld_handler);
658-
is($p->start()->wait_stop()->exit_status(),
659-
0, 'sigchld_handler.pl exit with 0');
649+
$p = process(execute => $^X)->args([$sigchld_handler])->start()->wait_stop();
650+
is $p->exit_status(), 0, 'sigchld_handler.pl exit with 0' or do {
651+
diag "out: " . $p->read_stdout;
652+
diag "err: " . $p->read_stderr;
653+
};
660654
like($p->read_all_stdout, qr/SIG_CHLD/, "SIG_CHLD handler was executed");
661655
};
662656

0 commit comments

Comments
 (0)