tools/pyboard: Tighten up Pyboard object closure on errors.

Some "device" implementations may be sensitive to this.
This commit is contained in:
Paul Sokolovsky 2017-04-02 20:46:32 +03:00
parent ca81c3ab0b
commit 9b3f423c14
1 changed files with 2 additions and 0 deletions

View File

@ -300,6 +300,7 @@ def main():
pyb.enter_raw_repl() pyb.enter_raw_repl()
except PyboardError as er: except PyboardError as er:
print(er) print(er)
pyb.close()
sys.exit(1) sys.exit(1)
def execbuffer(buf): def execbuffer(buf):
@ -307,6 +308,7 @@ def main():
ret, ret_err = pyb.exec_raw(buf, timeout=None, data_consumer=stdout_write_bytes) ret, ret_err = pyb.exec_raw(buf, timeout=None, data_consumer=stdout_write_bytes)
except PyboardError as er: except PyboardError as er:
print(er) print(er)
pyb.close()
sys.exit(1) sys.exit(1)
except KeyboardInterrupt: except KeyboardInterrupt:
sys.exit(1) sys.exit(1)