Skip to content

Commit

Permalink
get ride of multiprocessing (simpler)
Browse files Browse the repository at this point in the history
  • Loading branch information
tshirtman committed Jul 29, 2012
1 parent b85cd48 commit a4f1760
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions reloader.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
from multiprocessing import Process, Queue
from subprocess import Popen
from argparse import ArgumentParser, REMAINDER
from time import sleep
Expand All @@ -19,25 +18,16 @@ def __init__(self, command, path, ignorelist, **kwargs):
self.command = command
self.start()

def start(self):
q = Queue()
self.process = Process(target=self._start, args=(q,))
self.process.start()
self._process = q.get()
print self, 'SELF'

def stop(self):
self._process.terminate()
print 'TERMINATED'

def _start(self, q):
_process = Popen(self.command)
q.put(_process)
print 'STARTED', _process
def start(self):
self._process = Popen(self.command)
print 'STARTED', self._process

def on_any_event(self, event):
print 'terminating', self
print self.process, '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
self.stop()
self.start()

Expand Down

0 comments on commit a4f1760

Please sign in to comment.