Exit gracefully with an error code whenever backend exits
This commit is contained in:
parent
4280c3f052
commit
b82a13c467
|
@ -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))
|
||||
|
||||
|
|
Loading…
Reference in New Issue