Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 17th, 2012  |  syntax: Python  |  size: 0.40 KB  |  hits: 22  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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