Close when stdin get eof

This commit is contained in:
Ray 2008-09-29 19:40:42 -05:00
parent 4500f48aa7
commit 968e9e3c5a

4
pyfpdb/HUD_main.py Executable file → Normal file
View File

@ -99,12 +99,16 @@ def check_stdin(db_name):
def read_stdin(source, condition, db_name): def read_stdin(source, condition, db_name):
new_hand_id = sys.stdin.readline() new_hand_id = sys.stdin.readline()
if new_hand_id == "":
destroy()
process_new_hand(new_hand_id, db_name) process_new_hand(new_hand_id, db_name)
return True return True
def producer(): # This is the thread function def producer(): # This is the thread function
while True: while True:
hand_no = sys.stdin.readline() # reads stdin hand_no = sys.stdin.readline() # reads stdin
if new_hand_id == "":
destroy()
dataQueue.put(hand_no) # and puts result on the queue dataQueue.put(hand_no) # and puts result on the queue
if __name__== "__main__": if __name__== "__main__":