You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
532 B
19 lines
532 B
import subprocess
|
|
|
|
|
|
class Launcher:
|
|
def __init__(self, args, work_dir):
|
|
self.args = args
|
|
self.work_dir = work_dir
|
|
self.process = None
|
|
|
|
def fire(self):
|
|
self.process = subprocess.Popen(self.args, stdout=subprocess.PIPE,
|
|
stderr=subprocess.PIPE, cwd=self.work_dir,
|
|
encoding="utf-8")
|
|
|
|
def readline(self):
|
|
return self.process.stdout.readline().strip()
|
|
|
|
def stop(self):
|
|
self.process.terminate()
|
|
|