]> git.sur5r.net Git - i3/i3/commitdiff
i3-wsbar: correctly handle EOF on stdin
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 2 Aug 2011 21:31:03 +0000 (23:31 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Wed, 3 Aug 2011 22:40:40 +0000 (00:40 +0200)
i3-wsbar

index 4e2723167654cef3e560e11566d2e4c8f0409e2a..2d546a734ca9415185297d97b0fd8b9749caa6b4 100755 (executable)
--- a/i3-wsbar
+++ b/i3-wsbar
@@ -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();
     });