Revision history for Perl extension DBIx::Class::Schema::Loader
+ - use a temp file for filter_generated_code with a string program name
+ instead of IPC::Open2, which hangs on Win32 (RT#72226)
- previous version referred to the wrong RT# for the uniq_to_primary
change, it is actually (RT#51696)
use DBIx::Class ();
use Encode qw/encode decode/;
use List::MoreUtils qw/all firstidx/;
-use IPC::Open2;
-use Symbol 'gensym';
+use File::Temp 'tempfile';
use namespace::clean;
our $VERSION = '0.07011';
);
}
else {
- my ($out, $in) = (gensym, gensym);
+ my ($fh, $temp_file) = tempfile();
- my $pid = open2($out, $in, $filter)
- or croak "Could not open pipe to $filter: $!";
-
- print $in $text;
+ binmode $fh, ':encoding(UTF-8)';
+ print $fh $text;
+ close $fh;
- close $in;
+ open my $out, qq{$filter < "$temp_file"|}
+ or croak "Could not open pipe to $filter: $!";
$text = decode('UTF-8', do { local $/; <$out> });
$text =~ s/$CR?$LF/\n/g;
- waitpid $pid, 0;
+ close $out;
my $exit_code = $? >> 8;
+ unlink $temp_file
+ or croak "Could not remove temporary file '$temp_file': $!";
+
if ($exit_code != 0) {
croak "filter '$filter' exited non-zero: $exit_code";
}