0

Read all supplied lines from STDIN, not just first one.

This commit is contained in:
Sergei Fedosov
2021-07-20 01:58:15 +03:00
parent 24b7a97372
commit 08bf20d43a
2 changed files with 38 additions and 37 deletions

View File

@@ -26,3 +26,4 @@ verbose = 8
[-Modules::RequireVersionVar] [-Modules::RequireVersionVar]
[-CodeLayout::RequireTidyCode] [-CodeLayout::RequireTidyCode]
[-TestingAndDebugging::RequireUseWarnings] [-TestingAndDebugging::RequireUseWarnings]
[-ControlStructures::ProhibitDeepNests]

View File

@@ -229,11 +229,10 @@ sub add_events () {
fh => \*STDIN, fh => \*STDIN,
poll => 'r', poll => 'r',
cb => sub { cb => sub {
my $msg = <>; while (my $msg = <>) {
unless ($STDIN_FIRST_LINE_DROPPED) { unless ($STDIN_FIRST_LINE_DROPPED) {
$msg = <>;
$STDIN_FIRST_LINE_DROPPED = 1; $STDIN_FIRST_LINE_DROPPED = 1;
next;
} }
if ($msg) { if ($msg) {
@@ -277,6 +276,7 @@ sub add_events () {
} }
} }
} }
}
); );
# poll caps lock status, on one of my laptop there is no led for this :( # poll caps lock status, on one of my laptop there is no led for this :(