You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After using capture(), STDERR is left in line buffered mode, i.e. it is no longer "hot". You have to manually set $| to restore unbuffered mode.
Example program demonstrating the issue:
#!/usr/bin/env perl
use v5.10;
use strict;
use warnings;
use Capture::Tiny qw(capture);
print STDERR __LINE__; # prints immediately as expected
# my $out = `date`; # stderr is fine if using this line instead of the next
my ($out, $err) = capture { system 'date' }; # leaves stderr in buffered mode
say $out;
# $| = 1, select $_ for select STDERR;
# won't print unless prev line is uncommented or script exits normally.
print STDERR __LINE__;
sleep 10;
The text was updated successfully, but these errors were encountered:
After using
capture()
, STDERR is left in line buffered mode, i.e. it is no longer "hot". You have to manually set$|
to restore unbuffered mode.Example program demonstrating the issue:
The text was updated successfully, but these errors were encountered: