make pyterm nicely fails if no port is available

cc430
Alexandre Abadie 8 years ago
parent 3fc71ef694
commit 0d9f14c848

@ -210,7 +210,12 @@ class SerCmd(cmd.Cmd):
# otherwise go for the serial port
elif self.port:
self.logger.info("Connect to serial port %s" % self.port)
self.serial_connect()
try:
self.serial_connect()
except OSError as e:
self.logger.error("Cannot connect to serial port {}: {}"
.format(self.port, e.strerror))
sys.exit(1)
# wait until connection is established and fire startup
# commands to the node

Loading…
Cancel
Save