forked from paradoxxxzero/butterfly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.py
More file actions
executable file
·47 lines (40 loc) · 1.22 KB
/
dev.py
File metadata and controls
executable file
·47 lines (40 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python
from multiprocessing import Process
from subprocess import Popen
from glob import glob
import time
import sys
import shlex
commands = [
'coffee -wcb -j butterfly/static/javascripts/main.js ' +
'butterfly/static/coffees/term.coffee ' +
'butterfly/static/coffees/selection.coffee ' +
'butterfly/static/coffees/virtual_input.coffee ' +
'butterfly/static/coffees/main.coffee ',
'compass watch butterfly/static',
'python butterfly.server.py ' + ' '.join(sys.argv[1:])
]
class Run(Process):
daemon = True
def __init__(self, command, *args, **kwargs):
super(Run, self).__init__(*args, **kwargs)
self.cmd = command
def run(self):
try:
while True:
self.proc = Popen(shlex.split(self.cmd))
self.proc.wait()
print(self.cmd + ' exited. Relaunching in 250ms')
time.sleep(.25)
except KeyboardInterrupt:
pass
process = [Run(cmd) for cmd in commands]
for proc in process:
print('Lauching %s' % proc.cmd.split(' ')[0])
proc.start()
try:
for proc in process:
proc.join()
print('Joined')
except KeyboardInterrupt:
print('\nGot [ctrl]+[c] -- bye bye')