SHARE
TWEET

Untitled

a guest May 17th, 2012 32 Never
  1. import subprocess, threading, time
  2. can_break = False
  3.  
  4. def run():
  5.     args = ["localtunnel", "8000"]
  6.     popen = subprocess.Popen(args)
  7.     popen.wait()
  8.     print '%s ended with return code: %d' % (args[0], popen.returncode)
  9.  
  10. t = threading.Thread(target=run)
  11.  
  12. try:
  13.     t.start()
  14.     while True:
  15.         print 'Main thread...'
  16.         time.sleep(1)
  17. except KeyboardInterrupt:
  18.     can_break = True
RAW Paste Data
Top