Skip to content

Instantly share code, notes, and snippets.

@iwamatsu0430
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iwamatsu0430/f2dc37e0aa610f4efa45 to your computer and use it in GitHub Desktop.
Save iwamatsu0430/f2dc37e0aa610f4efa45 to your computer and use it in GitHub Desktop.
convert gulp watch zombie
#!/usr/bin/env python
# -*- codint: utf-8 -*-
import sys
import signal
import subprocess
def rite(silent):
print("start rite of gulp watch be zombie")
print("if you want stop this program, Ctrl+C")
cmd = "gulp watch"
while True:
p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
for line in iter(p.stdout.readline, b''):
print(line.rstrip())
if not silent:
print("\a")
print("\ngulp watch is dead. but revive soon.\n")
def signalHandler(signal, frame):
print("\ngulp zombie killed")
sys.exit(0)
if __name__ == '__main__':
signal.signal(signal.SIGINT, signalHandler)
try:
sys.argv.index("-s")
rite(True)
except ValueError:
rite(False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment