Commit cef4c50a authored by D1plo1d's avatar D1plo1d

Exiting with an error when prontserve fails to connect on startup. Exiting...

Exiting with an error when prontserve fails to connect on startup. Exiting properly if ctrl+c is pressed durring prontserve startup.
parent 037708c6
...@@ -569,7 +569,20 @@ if __name__ == "__main__": ...@@ -569,7 +569,20 @@ if __name__ == "__main__":
print "Prontserve is starting..." print "Prontserve is starting..."
prontserve = Prontserve(dry_run=dry_run) prontserve = Prontserve(dry_run=dry_run)
if dry_run==False: prontserve.do_connect("")
try:
if dry_run==False:
prontserve.do_connect("")
print "Connecting"
for x in range(0,50-1):
if prontserve.p.online == True: break
sys.stdout.write(".")
sys.stdout.flush()
time.sleep(0.1)
print ""
if prontserve.p.online == False:
print "Unable to connect to printer: Connection timed-out."
sys.exit(1)
time.sleep(1) time.sleep(1)
prontserve.run_sensor_loop() prontserve.run_sensor_loop()
...@@ -587,7 +600,6 @@ if __name__ == "__main__": ...@@ -587,7 +600,6 @@ if __name__ == "__main__":
warn_if_dry_run() warn_if_dry_run()
print "-"*80 + "\n" print "-"*80 + "\n"
try:
prontserve.ioloop.start() prontserve.ioloop.start()
except: except:
prontserve.p.disconnect() prontserve.p.disconnect()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment