|
1 | 1 | #!/usr/bin/env perl |
2 | 2 | use strict; |
3 | 3 | use warnings; |
| 4 | +use File::Spec; |
4 | 5 | use File::Spec::Functions qw(catfile); |
5 | 6 | use File::Temp qw(tempdir); |
6 | | -use IPC::Open3; |
7 | 7 | use Test::More; |
8 | 8 | use lib qw(./lib ../lib t/lib); |
9 | 9 | use Test::PhenoRanker qw(fixture); |
10 | 10 | use Pheno::Ranker::IO qw(read_json read_yaml); |
11 | 11 |
|
12 | 12 | # The command line script to be tested |
13 | 13 | my $script = catfile( 'utils', 'csv2pheno_ranker', 'csv2pheno-ranker' ); |
14 | | -my $inc = join ' -I', '', @INC; # prepend -I to each path in @INC |
15 | 14 | my @inc = map { ( '-I', $_ ) } @INC; |
16 | 15 |
|
17 | 16 | ############ |
@@ -100,12 +99,17 @@ sub write_file { |
100 | 99 | } |
101 | 100 |
|
102 | 101 | 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(@_); |
109 | 113 | } |
110 | 114 |
|
111 | 115 | done_testing(); |
0 commit comments