fifo_bridge.py: Catch SerialException; default FIFO without extension
This commit is contained in:
parent
23195805be
commit
8f54104f5c
1 changed files with 6 additions and 5 deletions
|
@ -4,9 +4,10 @@ import os
|
|||
import sys
|
||||
import time
|
||||
import mapid
|
||||
from serial.serialutil import SerialException
|
||||
|
||||
|
||||
FIFO = "/tmp/mapid.fifo"
|
||||
FIFO = "/tmp/mapid"
|
||||
|
||||
|
||||
def main():
|
||||
|
@ -19,10 +20,7 @@ def main():
|
|||
os.mkfifo(FIFO)
|
||||
time.sleep(0.2)
|
||||
print("Created FIFO " + FIFO, file=sys.stderr)
|
||||
# f = open(FIFO, "w")
|
||||
# f.write("\n")
|
||||
# f.close()
|
||||
# print("Created FIFO " + FIFO, file=sys.stderr)
|
||||
|
||||
f = open(FIFO, "r")
|
||||
print("Opened FIFO for reading", file=sys.stderr)
|
||||
m.cls()
|
||||
|
@ -39,6 +37,9 @@ def main():
|
|||
except KeyboardInterrupt:
|
||||
keep_going = False
|
||||
print()
|
||||
except SerialException:
|
||||
keep_going = False
|
||||
print("Caught a SerialException. Exiting now...", file=sys.stderr)
|
||||
|
||||
os.remove(FIFO)
|
||||
print("Removed FIFO.", file=sys.stderr)
|
||||
|
|
Loading…
Reference in a new issue