Skip to content

Commit 96f91f1

Browse files
committed
Tests: unbreak reading new stderr data after eof.
Tests don't expect to stop reading redirected stderr when end of file is reached, but rather to read new data being appended, similar to "tail -f". The behaviour is found changed in Ubuntu 23.04's Perl 5.36, which applies the upstream patch [1] expected for inclusion in the upcoming Perl 5.38. The fix is to clear the filehandle's error state to continue reading. [1] Perl/perl5@80c1f1e45e8e Updated mail_error_log.t and stream_error_log.t for consistency.
1 parent 1084058 commit 96f91f1

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

error_log.t

+3-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,9 @@ sub lines {
183183
my ($t, $file, $pattern) = @_;
184184

185185
if ($file eq 'stderr') {
186-
return map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
186+
my $value = map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
187+
$stderr->clearerr();
188+
return $value;
187189
}
188190

189191
my $path = $t->testdir() . '/' . $file;

mail_error_log.t

+3-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,9 @@ sub lines {
144144
my ($t, $file, $pattern) = @_;
145145

146146
if ($file eq 'stderr') {
147-
return map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
147+
my $value = map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
148+
$stderr->clearerr();
149+
return $value;
148150
}
149151

150152
my $path = $t->testdir() . '/' . $file;

stream_error_log.t

+3-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,9 @@ sub lines {
150150
my ($t, $file, $pattern) = @_;
151151

152152
if ($file eq 'stderr') {
153-
return map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
153+
my $value = map { $_ =~ /\Q$pattern\E/ } (<$stderr>);
154+
$stderr->clearerr();
155+
return $value;
154156
}
155157

156158
my $path = $t->testdir() . '/' . $file;

0 commit comments

Comments
 (0)