Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions resources/site-packages/pulsar/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,17 @@ def pulsard_thread(monitor):
# read. We count on the fact that Pulsar daemon flushes its log
# output on \n, creating a pretty clean output
import fcntl
import select
fd = proc.stdout.fileno()
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
while proc.poll() is None:
try:
log.info(proc.stdout.readline())
continue
except IOError:
time.sleep(1) # nothing to read, sleep
to_read, _, _ = select.select([proc.stdout], [], [])
for obj in to_read:
line = obj.readline()
if line == "": # write end is closed
break
log.info(line)

if proc.returncode == 0 or xbmc.abortRequested:
break
Expand Down