[PATCH 0 of 1] Tests: unbreak reading new stderr data after eof ...

Sergey Kandaurov pluknet at nginx.com
Fri May 26 11:24:11 UTC 2023


Simple test to reproduce.

#!/usr/bin/perl

use warnings;
use strict;

open STDERR, '>', 'stderr' or die "Can't reopen STDERR: $!";
open my $stderr, '<', 'stderr' or die "Can't open stderr file: $!";

if (fork() == 0) {
	print STDERR "SEE-THIS";
	sleep 1;
	print STDERR "AND-THAT";
	exit 0;
}

use Data::Dumper;

select undef, undef, undef, 0.1 until -s 'stderr' > 0;
my $n = -s 'stderr';
print Dumper <$stderr>;
print "size = $n pos = ", tell $stderr, "\n";

select undef, undef, undef, 0.1 until -s 'stderr' > $n;
$n = -s 'stderr';
print Dumper <$stderr>;
print "size = $n pos = ", tell $stderr, "\n";

###############################################################################

vanilla perl$ perl test_readline.t
$VAR1 = 'SEE-THIS';
size = 8 pos = 8
$VAR1 = 'AND-THAT';
size = 16 pos = 16

80c1f1e45e8e$ perl test_readline.t 
$VAR1 = 'SEE-THIS';
size = 8 pos = 8
size = 16 pos = 8


More information about the nginx-devel mailing list