I'm working on some Python code for a robot. This code utilizes barcode input from a scanner and uses regex to filter the appropriate data. The trouble is, the input is pulled in from the command line. It pulls the input fine, but doesn't close itself when there's no more input.
buffer = ""
while True:
line = sys.stdin.readline().rstrip()
if not line:
break
else:
buffer.join(line)
print buffer
Any help would be much appreciated.
Edit: I should mention that this is on Linux and that the laptop that this is running on is closed, and I am not allowed to manually stop the program.