def __init__(self): self.__procs = dict() self.__creationflags = 0 if sys.platform == "win32": self.__creationflags = subprocess.CREATE_NEW_PROCESS_GROUP self.outputlock = threading.Lock() self.dose_main = self.launchProcess("dose_main", dose_main_cmd) self.launchProcess("dope_main", dope_main_cmd) self.syslog = syslog_server.SyslogServer() self.syslog_output = list() start_time = time.time() print("Waiting for dose_main to be ready") while True: time.sleep(0.2) if self.Output("dose_main").find( "persistence data is ready") != -1: print(" dose_main seems to be ready") break if self.dose_main.poll() is not None: raise Exception( " dose_main appears to have failed to start!\n" + "----- Output so far ----\n" + self.Output("dose_main") + "\n---------------------") if time.time() - start_time > 90: start_time = time.time() print("dose_main seems slow to start. Here is some output:") print("----- dose_main output -----") print(self.Output("dose_main")) print("----- dope_main output -----") print(self.Output("dope_main")) print("---- syslog output ----") print(self.syslog.get_data(0)) print("----------------------------") print("Will keep waiting")
sender_path_base = os.path.join(exe_path, "tracer_sender_dotnet") sender_csexe = sender_path_base + ".csexe" sender_exe = sender_path_base + ".exe" shutil.copy2(sender_csexe, sender_exe) SAFIR_RUNTIME = os.environ.get("SAFIR_RUNTIME") dependencies = ( "Safir.Dob.Typesystem.dll", "Safir.SwReports.dll", ) for dep in dependencies: shutil.copy2(os.path.join(SAFIR_RUNTIME, "bin", dep), ".") syslog = syslog_server.SyslogServer() o1 = subprocess.check_output(sender_exe) o2 = subprocess.check_output(sender_exe) o3 = subprocess.check_output(sender_exe) os.remove(sender_exe) for dep in dependencies: os.remove(dep) stdout_output = (o1 + o2 + o3).decode("utf-8").replace("\r", "") syslog_output = syslog.get_data(1) #fix unexpected locale stdout_output = stdout_output.replace("123,1", "123.1") syslog_output = syslog_output.replace("123,1", "123.1")