Skip to content

Commit

Permalink
manual import of IPC-Run3-0.042 from CPAN
Browse files Browse the repository at this point in the history
  • Loading branch information
Roderich Schupp authored and rjbs committed Jan 15, 2009
1 parent e02c7b7 commit a89e741
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
6 changes: 6 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
Changes file for IPC::Run3

0.042 2008-08-09
No code changes
Rewrite a test in t/utf8.t that runs afoul of a misfeature
in Perl 5.8.0 (turn on ":utf8" by default on all filehandles
when running in a UTF8 locale; fixed since 5.8.1)

0.041 2008-08-03
Handle arbitrary binmode() layers in "binmode_*" options; for
backward compatibility, any true option that doesn't start
Expand Down
2 changes: 1 addition & 1 deletion META.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- #YAML:1.0
name: IPC-Run3
version: 0.041
version: 0.042
abstract: run a subprocess with input/ouput redirection
license: open_source
author: Barrie Slaymaker <barries@slaysys.com>
Expand Down
2 changes: 1 addition & 1 deletion lib/IPC/Run3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ version 0.041
=cut

$VERSION = '0.041';
$VERSION = '0.042';

=head1 SYNOPSIS
Expand Down
20 changes: 11 additions & 9 deletions t/utf8.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Test::More;
plan skip_all => qq["binmode FH, ':utf8'" needs Perl >= 5.8]
unless $^V >= 5.008;
plan tests => 4;
plan tests => 3;
use IPC::Run3;
use strict;

Expand All @@ -14,23 +14,25 @@ my ( $in, $out, $err );
my $generate_unicode = qq[pack("U3", 0xe4, 0xf6, 0xfc)];
# bytes encoding the above in UTF8
my @expected_bytes = ( 0xc3, 0xa4, 0xc3, 0xb6, 0xc3, 0xbc );
my @got_bytes;

# read as UTF8
( $in, $out, $err ) = ();
run3 [$^X, "-e", "binmode STDOUT, ':utf8'; print $generate_unicode" ],
run3 [ $^X, "-e", "binmode STDOUT, ':utf8'; print $generate_unicode" ],
\undef, \$out, \undef, { binmode_stdout => ':utf8' };
is length($out), 3, "read Unicode string of 3 characters";
{ use bytes; @got_bytes = unpack("C*", $out); }
is "@got_bytes", "@expected_bytes", "compare raw bytes";
my @got_bytes;
{ use bytes; @got_bytes = unpack('C*', $out); }
is "@got_bytes", "@expected_bytes", "compare raw bytes read from command";

# write as UTF8
# NOTE: extra careful here, only write "Unicode safe" stuff in the child perl;
# e.g. Perl 5.8.0 might have ":utf8" implicitly turned on for STDOUT when
# invoked in a UTF8 locale (resulting in 12 bytes read into $out when simply
# copying STDIN to STDOUT)
( $in, $out, $err ) = ();
$in = eval $generate_unicode;
run3 [$^X, "-e", "binmode STDIN, ':raw'; print <>" ],
run3 [ $^X, "-e", "binmode STDIN, ':raw'; print join(' ', unpack('C*', <>))" ],
\$in, \$out, \undef, { binmode_stdin => ':utf8' };
is length($out), 6, "wrote string of 6 bytes";
{ use bytes; @got_bytes = unpack("C*", $out); }
is "@got_bytes", "@expected_bytes", "compare raw bytes";
is $out, "@expected_bytes", "compare raw bytes written to command";


0 comments on commit a89e741

Please sign in to comment.