Maybe the module should respect (i.e. forward) that IO layers on the standard handles
when it reopens them?
Example:
use feature qw(say);
use strict;
use warnings;
use open qw/:std IN :encoding(utf-8) OUT :utf8/;
use Cwd qw(getcwd);
use Proc::Daemon;
say join ' ', (PerlIO::get_layers(\*STDOUT));
my $work_dir = getcwd;
my $daemon = Proc::Daemon->new(
work_dir => $work_dir,
child_STDOUT => 'stdout.txt',
child_STDERR => 'stderr.txt',
pid_file => 'pid.txt',
);
my $pid = $daemon->Init();
if ( $pid == 0 ) {
say join ' ', (PerlIO::get_layers(\*STDOUT));
}
The output from the script is:
but the output to file stdout.txt is missing the utf8 layer:
Maybe the module should respect (i.e. forward) that IO layers on the standard handles
when it reopens them?
Example:
The output from the script is:
but the output to file
stdout.txtis missing theutf8layer: