Skip to content

Commit 44562b2

Browse files
committed
Source commit
1 parent eec67ce commit 44562b2

2 files changed

Lines changed: 23 additions & 16 deletions

File tree

t/06-csv2pheno-ranker.t

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
#!/usr/bin/env perl
22
use strict;
33
use warnings;
4+
use File::Spec;
45
use File::Spec::Functions qw(catfile);
56
use File::Temp qw(tempdir);
6-
use IPC::Open3;
77
use Test::More;
88
use lib qw(./lib ../lib t/lib);
99
use Test::PhenoRanker qw(fixture);
1010
use Pheno::Ranker::IO qw(read_json read_yaml);
1111

1212
# The command line script to be tested
1313
my $script = catfile( 'utils', 'csv2pheno_ranker', 'csv2pheno-ranker' );
14-
my $inc = join ' -I', '', @INC; # prepend -I to each path in @INC
1514
my @inc = map { ( '-I', $_ ) } @INC;
1615

1716
############
@@ -100,12 +99,17 @@ sub write_file {
10099
}
101100

102101
sub run_quietly {
103-
open my $null_in, '<', File::Spec->devnull;
104-
open my $null_out, '>', File::Spec->devnull;
105-
open my $null_err, '>', File::Spec->devnull;
106-
my $pid = open3( $null_in, $null_out, $null_err, @_ );
107-
waitpid $pid, 0;
108-
return $?;
102+
open my $null_in, '<', File::Spec->devnull
103+
or die 'Cannot open null device for reading: ' . $!;
104+
open my $null_out, '>', File::Spec->devnull
105+
or die 'Cannot open null device for writing: ' . $!;
106+
open my $null_err, '>', File::Spec->devnull
107+
or die 'Cannot open null device for writing: ' . $!;
108+
109+
local *STDIN = $null_in;
110+
local *STDOUT = $null_out;
111+
local *STDERR = $null_err;
112+
return system(@_);
109113
}
110114

111115
done_testing();

t/07-bff-pxf-simulator.t

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
use strict;
33
use warnings;
44
use File::Spec;
5-
use IPC::Open3;
65
use JSON::XS;
76
use Test::More;
87
use File::Compare;
@@ -14,7 +13,6 @@ my $seed = 123456789;
1413

1514
# The command line script to be tested
1615
my $script = File::Spec->catfile( 'utils', 'bff_pxf_simulator', 'bff-pxf-simulator' );
17-
my $inc = join ' -I', '', @INC; # prepend -I to each path in @INC
1816
my @inc = map { ( '-I', $_ ) } @INC;
1917

2018
##########
@@ -243,12 +241,17 @@ for my $case (
243241
}
244242

245243
sub run_quietly {
246-
open my $null_in, '<', File::Spec->devnull;
247-
open my $null_out, '>', File::Spec->devnull;
248-
open my $null_err, '>', File::Spec->devnull;
249-
my $pid = open3( $null_in, $null_out, $null_err, @_ );
250-
waitpid $pid, 0;
251-
return $?;
244+
open my $null_in, '<', File::Spec->devnull
245+
or die 'Cannot open null device for reading: ' . $!;
246+
open my $null_out, '>', File::Spec->devnull
247+
or die 'Cannot open null device for writing: ' . $!;
248+
open my $null_err, '>', File::Spec->devnull
249+
or die 'Cannot open null device for writing: ' . $!;
250+
251+
local *STDIN = $null_in;
252+
local *STDOUT = $null_out;
253+
local *STDERR = $null_err;
254+
return system(@_);
252255
}
253256

254257
sub decode_json_file {

0 commit comments

Comments
 (0)