diff --git a/ethermess.py b/ethermess.py index e428dee..6c44eb8 100644 --- a/ethermess.py +++ b/ethermess.py @@ -511,7 +511,7 @@ def eventloop(proc): elif fd == proc.stdout.fileno() and event & select.POLLHUP: print('--- Backend exited') - running = False + sys.exit(1) elif fd == unbuf_stdin.fileno() and event & select.POLLIN: data = unbuf_stdin.read(1024) @@ -557,7 +557,11 @@ def main(): writeall(proc.stdin, bytes([own_status.value, len(encoded)]) + encoded) # Read our MAC - mac = readall(proc.stdout, 6) + try: + mac = readall(proc.stdout, 6) + except ReadallError: + print('--- Backend exited') + sys.exit(1) print('--- MAC: %s' % format_mac(mac))