# HG changeset patch # User Edouard Tisserant # Date 1362530428 -32400 # Node ID 511bf048b8b72421da834c09412b684aa0dc12c5 # Parent 463d4b2b058db1fd16ced6e49ce4e4401b775a51 Added CWD to ProcessLogger, and make sure local runtime have CWD setup correctly diff -r 463d4b2b058d -r 511bf048b8b7 Beremiz.py --- a/Beremiz.py Tue Mar 05 20:14:12 2013 +0900 +++ b/Beremiz.py Wed Mar 06 09:40:28 2013 +0900 @@ -493,13 +493,15 @@ self.runtime_port = int(random.random() * 1000) + 61131 # launch local runtime self.local_runtime = ProcessLogger(self.Log, - "\"%s\" \"%s\" -p %s -i localhost %s %s"%(sys.executable, - Bpath("Beremiz_service.py"), - self.runtime_port, - {False : "-x 0", True :"-x 1"}[taskbaricon], - self.local_runtime_tmpdir), - no_gui=False, - timeout=500, keyword = "working") + "\"%s\" \"%s\" -p %s -i localhost %s %s"%( + sys.executable, + Bpath("Beremiz_service.py"), + self.runtime_port, + {False : "-x 0", True :"-x 1"}[taskbaricon], + self.local_runtime_tmpdir), + no_gui=False, + timeout=500, keyword = "working", + cwd = self.local_runtime_tmpdir) self.local_runtime.spin() return self.runtime_port diff -r 463d4b2b058d -r 511bf048b8b7 util/ProcessLogger.py --- a/util/ProcessLogger.py Tue Mar 05 20:14:12 2013 +0900 +++ b/util/ProcessLogger.py Wed Mar 06 09:40:28 2013 +0900 @@ -71,7 +71,7 @@ def __init__(self, logger, Command, finish_callback = None, no_stdout = False, no_stderr = False, no_gui = True, timeout = None, outlimit = None, errlimit = None, - endlog = None, keyword = None, kill_it = False): + endlog = None, keyword = None, kill_it = False, cwd = None): self.logger = logger if not isinstance(Command, list): self.Command_str = Command @@ -107,7 +107,7 @@ self.endlock = Lock() popenargs= { - "cwd":os.getcwd(), + "cwd":os.getcwd() if cwd is None else cwd, "stdin":subprocess.PIPE, "stdout":subprocess.PIPE, "stderr":subprocess.PIPE}