import subprocess, threading, time
can_break = False
def run():
args = ["localtunnel", "8000"]
popen = subprocess.Popen(args)
popen.wait()
print '%s ended with return code: %d' % (args[0], popen.returncode)
t = threading.Thread(target=run)
try:
t.start()
while True:
print 'Main thread...'
time.sleep(1)
except KeyboardInterrupt:
can_break = True