Permalink
Browse files

Convert from pipe open to IPC::Open2

  • Loading branch information...
Leont committed Jul 2, 2012
1 parent a00b916 commit e0448766d818395c41d46c4a3b146f38bf1e774a
Showing with 7 additions and 5 deletions.
  1. +1 −0 Changes
  2. +6 −5 lib/Devel/FindPerl.pm
View
@@ -1,6 +1,7 @@
Revision history for Devel-FindPerl
{{$NEXT}}
+ Convert from pipe open to IPC::Open2
0.002 2012-07-12 18:46:33 Europe/Bucharest
Get rid of Capture::Tiny dependency
View
@@ -9,6 +9,7 @@ use Carp;
use Cwd;
use ExtUtils::Config;
use File::Spec;
+use IPC::Open2;
sub find_perl_interpreter {
my $config = shift || ExtUtils::Config->new;
@@ -106,12 +107,12 @@ sub _perl_is_same {
# from a different configuration that happens to be already
# installed in @INC.
push @cmd, '-I' . File::Spec->catdir(File::Basename::dirname($perl), 'lib') if $ENV{PERL_CORE};
-
push @cmd, qw(-MConfig=myconfig -e print -e myconfig);
- open my $fh, '-|', @cmd or return;
- my $myconfig = join '', <$fh>;
- close $fh or return;
- return $myconfig eq Config->myconfig;
+
+ my $pid = open2(my($in, $out), @cmd);
+ my $ret = do { local $/; <$in> };
+ waitpid $pid, 0;
+ return $ret eq Config->myconfig;
}
1;

0 comments on commit e044876

Please sign in to comment.