|
@@ -66,13 +66,16 @@ class PManager:
|
|
|
|
|
|
|
|
#log(j)
|
|
#log(j)
|
|
|
if j["command"] == "oneshot":
|
|
if j["command"] == "oneshot":
|
|
|
- self.oneshot(j["key"])
|
|
|
|
|
|
|
+ opts = None
|
|
|
|
|
+ if "options" in j:
|
|
|
|
|
+ opts = j["options"]
|
|
|
|
|
+ self.oneshot(j["key"], opts)
|
|
|
|
|
|
|
|
if j["command"] == "launch":
|
|
if j["command"] == "launch":
|
|
|
opts = None
|
|
opts = None
|
|
|
if "options" in j:
|
|
if "options" in j:
|
|
|
opts = j["options"]
|
|
opts = j["options"]
|
|
|
- self.launch(j["key"],opts)
|
|
|
|
|
|
|
+ self.launch(j["key"], opts)
|
|
|
|
|
|
|
|
if j["command"] == "kill":
|
|
if j["command"] == "kill":
|
|
|
self.stop(j["key"])
|
|
self.stop(j["key"])
|
|
@@ -137,13 +140,20 @@ class PManager:
|
|
|
del self.p_list[key]
|
|
del self.p_list[key]
|
|
|
self.sendstatus()
|
|
self.sendstatus()
|
|
|
|
|
|
|
|
- def oneshot(self, key):
|
|
|
|
|
|
|
+ def oneshot(self, key, options=None):
|
|
|
if key not in self.ptable:
|
|
if key not in self.ptable:
|
|
|
log("This process (%s) is not on my table!" % key)
|
|
log("This process (%s) is not on my table!" % key)
|
|
|
return
|
|
return
|
|
|
log("Oneshotting! key: %s" % key)
|
|
log("Oneshotting! key: %s" % key)
|
|
|
|
|
+ tolaunch = self.ptable[key]
|
|
|
|
|
+ if options is not None:
|
|
|
|
|
+ options = [ o for o in options if type(o) is str ]
|
|
|
|
|
+ tolaunch = tolaunch + options
|
|
|
|
|
+
|
|
|
|
|
+ log(tolaunch)
|
|
|
|
|
+
|
|
|
try:
|
|
try:
|
|
|
- proc = subprocess.Popen(self.ptable[key], preexec_fn=os.setsid)
|
|
|
|
|
|
|
+ proc = subprocess.Popen(tolaunch, preexec_fn=os.setsid)
|
|
|
except Exception as e:
|
|
except Exception as e:
|
|
|
log(e)
|
|
log(e)
|
|
|
|
|
|