Close sys.stdin after we create the unbuffered version

This commit is contained in:
Juhani Krekelä 2019-07-15 11:08:44 +03:00
parent 78865bdc8e
commit d1a6bd7052
1 changed files with 3 additions and 1 deletions

View File

@ -193,8 +193,10 @@ def handle_message(mac, message):
print('<%s> %s' % (nick, ascii(line)))
def eventloop(proc):
# Create unbuffered version of stdin
# Create unbuffered version of stdin and close the old one as we
# won't need it anymore
unbuf_stdin = open(sys.stdin.buffer.fileno(), 'rb', buffering = 0)
sys.stdin.close()
# Set up a poll for inputs (but do output blockingly)
poll = select.poll()