Skip Menu |

This queue is for tickets about the IPC-Run3 CPAN distribution.

Report information
The Basics
Id: 69011
Status: stalled
Priority: 0/
Queue: IPC-Run3

People
Owner: Nobody in particular
Requestors: 0x62ash [...] gmail.com
Ben Bullock (no email address)
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.044
Fixed in: (no value)



Subject: binmode and run3 interaction
The following script outputs #!/home/ben/software/install/bin/perl use warnings; use strict; use IPC::Run3; use utf8; run3 (['/bin/ls'], undef, \my $out, \my $err); binmode STDOUT, ':utf8'; my $s = 'シグネス'; print "$s\n"; -----output: シグネス ----- but the following creates an error: #!/home/ben/software/install/bin/perl use warnings; use strict; use IPC::Run3; use utf8; binmode STDOUT, ':utf8'; run3 (['/bin/ls'], undef, \my $out, \my $err); my $s = 'シグネス'; print "$s\n"; -----output: Wide character in print at test.pl line 9. シグネス ----- It seems like run3 does not restore STDOUT fully to its former state on finishing.
On 2011-06-21 22:33:06, bkb@cpan.org wrote: Show quoted text
> It seems like run3 does not restore STDOUT fully to its former state on > finishing.
Good point, though I don't know how to correct that. Here's what run3 does to STDOUT: # "save" STDOUT open STDOUT_SAVE, ">&STDOUT"; # redirect STDOUT to an already open temp file open STDOUT, ">&" . fileno $out_fh; binmode STDOUT, ...; # depending on options # run command here ... # "restore" STDOUT open STDOUT, ">&STDOUT_SAVE"; Apparently this save/restore doesn't work wrt IO layers. Alternatively I don't know how to question a filehandle which layers are active (so that I could re-apply them after the restore). Cheers, Roderich
Some more data points (tried on Perl 5.8.8 and 5.14.0): - the warning "Wide character in print" is only shown when STDOUT is directed to a tty, but not when STDOUT is directed to a file or a pipe - PerlIO::get_layers(STDOUT, output => 1) before and after calling run3() confirms that indeed the "utf8" layer is lost for a tty, but not for a file or pipe There are open Perl bugs on this subject, e.g. perl #44701 and #44703.
This appears to be stalled for perl 44701 and 44703. -- rjbs
Subject: Run3 corrupt "utf8" layer
Date: Fri, 30 Oct 2015 22:56:33 +0300
To: bug-IPC-Run3 [...] rt.cpan.org
From: Alexander Batyrshin <0x62ash [...] gmail.com>
Here is test case. Second print produce "Wide character" warnings. Tested on 0.048 version. #!/usr/bin/perl use strict; use warnings; use utf8; use IPC::Run3 qw(run3); binmode STDERR, "utf8"; print STDERR "тест1\n"; run3( [ 'date' ], undef, undef, \my $err, {return_if_system_error => 1} ); print STDERR "тест2\n"; OUTPUT: $ perl bin/test/ipc_run.pl тест1 Fri Oct 30 20:26:58 CET 2015 Wide character in print at bin/test/ipc_run.pl line 17. тест2
Sorry, this reported bug is duplicate for - https://rt.cpan.org/Public/Bug/Display.html?id=69011