i3-wsbar: correctly handle EOF on stdin

This commit is contained in:
Michael Stapelberg 2011-08-02 23:31:03 +02:00
parent 3038ad6c26
commit 9d3c99ee38
1 changed files with 6 additions and 1 deletions

View File

@ -223,7 +223,12 @@ $stdin = AnyEvent->io(
fh => \*STDIN,
poll => 'r',
cb => sub {
chomp (my $line = <STDIN>);
my $line = <STDIN>;
if (!defined($line)) {
undef $stdin;
return;
}
chomp($line);
$last_line = $line;
update_output();
});