Пример #1
0
class Process(object):
    def __init__(self, command, working_dir, buffer_size=1):
        self.command = command
        self.buffer_size = buffer_size
        self.working_dir = working_dir

    def poll(self):
        if not self.process:
            return 0

        return self.process.poll()

    def start(self):
        self.process = Popen(str(self.command), cwd=self.working_dir, shell=True, stdout=PIPE, stderr=STDOUT)

    def stop(self):
        pid = self.process.pid
        os.kill(pid)

    def read_log(self):
        return self.process.asyncread()
Пример #2
0
 def start(self):
     self.process = Popen(str(self.command), cwd=self.working_dir, shell=True, stdout=PIPE, stderr=STDOUT)