aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/linereader.py
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-06-13 17:26:07 +0200
committerMattias Andrée <maandree@operamail.com>2014-06-13 17:26:07 +0200
commit040cd0ddc3256b1e4b7950abb8a5d60b2a80f2fd (patch)
treed5893dab5e51f3485cf2d2754e45c49bb7956259 /src/plugins/linereader.py
parentadd ipaddress (diff)
downloadxpybar-040cd0ddc3256b1e4b7950abb8a5d60b2a80f2fd.tar.gz
xpybar-040cd0ddc3256b1e4b7950abb8a5d60b2a80f2fd.tar.bz2
xpybar-040cd0ddc3256b1e4b7950abb8a5d60b2a80f2fd.tar.xz
fix line reader and add kmsg
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/plugins/linereader.py')
-rw-r--r--src/plugins/linereader.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/plugins/linereader.py b/src/plugins/linereader.py
index 643d7f9..103d15f 100644
--- a/src/plugins/linereader.py
+++ b/src/plugins/linereader.py
@@ -42,9 +42,11 @@ class LineReader:
if isinstance(channel, str):
self.__channel = channel = os.open(channel, os.O_RDONLY)
if isinstance(channel, int):
- next__ = lambda : channel.read()
+ channel = os.fdopen(channel)
+ next__ = lambda : channel.read(1)
buffer = ''
def next_():
+ nonlocal buffer
while True:
got = next__()
if (got is None) or (len(got) == 0):