Last active
August 29, 2015 14:27
-
-
Save iwamatsu0430/f2dc37e0aa610f4efa45 to your computer and use it in GitHub Desktop.
convert gulp watch zombie
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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