+ # Wait for the socket to be created
+ waited = 0
+ while not os.path.exists(socket):
+ rc = daemon.poll()
+ if rc is not None:
+ print "FATAL: daemon failed to start up"
+ sys.exit(1)
+ waited += 1
+ if waited == 1:
+ print " waiting for socket..."
+ elif waited >= 60:
+ print "FATAL: took too long for socket to appear"
+ sys.exit(1)
+ time.sleep(1)
+ if waited > 0:
+ print " took about %ds for socket to appear" % waited