mirror of
https://github.com/torvalds/linux.git
synced 2024-12-13 22:53:20 +00:00
4eac734486
On an old perl such as v5.10.1, `kselftest/prefix.pl` gives below error message: Can't locate object method "autoflush" via package "IO::Handle" at kselftest/prefix.pl line 10. This commit fixes the error by explicitly specifying the use of the `IO::Handle` package. Signed-off-by: SeongJae Park <sjpark@amazon.de> Acked-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
25 lines
471 B
Perl
Executable File
25 lines
471 B
Perl
Executable File
#!/usr/bin/perl
|
|
# SPDX-License-Identifier: GPL-2.0
|
|
# Prefix all lines with "# ", unbuffered. Command being piped in may need
|
|
# to have unbuffering forced with "stdbuf -i0 -o0 -e0 $cmd".
|
|
use strict;
|
|
use IO::Handle;
|
|
|
|
binmode STDIN;
|
|
binmode STDOUT;
|
|
|
|
STDOUT->autoflush(1);
|
|
|
|
my $needed = 1;
|
|
while (1) {
|
|
my $char;
|
|
my $bytes = sysread(STDIN, $char, 1);
|
|
exit 0 if ($bytes == 0);
|
|
if ($needed) {
|
|
print "# ";
|
|
$needed = 0;
|
|
}
|
|
print $char;
|
|
$needed = 1 if ($char eq "\n");
|
|
}
|