فهرست منبع

fix options + encode messages

David 10 سال پیش
والد
کامیت
a18a075cc9
1فایلهای تغییر یافته به همراه6 افزوده شده و 4 حذف شده
  1. 6 4
      pmanager.py

+ 6 - 4
pmanager.py

@@ -20,7 +20,8 @@ def sendmsg(msg):
     try:
         s.connect(('localhost', 9999))
         tosend = msg + "\r\n"
-        s.sendall(tosend.encode("ascii"))
+        encoded_msg = tosend.encode("ascii")
+        s.sendall(encoded_msg)
         ret = s.recv(4096)
         s.close()
     except Exception as e:
@@ -61,7 +62,10 @@ class PManager:
         
             log(j)
             if j["command"] == "launch":
-                self.launch(j["key"])
+                opts = None
+                if "options" in j:
+                    opts = j["options"]
+                self.launch(j["key"],opts)
         
             if j["command"] == "kill":
                 self.stop(j["key"])
@@ -132,5 +136,3 @@ class PManager:
 
         self.p_list[key] = proc
         return proc.pid
-
-