def __enter__(self): preexec_fn, creationflags = mx._get_new_progress_group_args() if mx._opts.verbose: mx.log(' '.join(['(background)'] + map(pipes.quote, self.args))) self.process = subprocess.Popen(self.args, preexec_fn=preexec_fn, creationflags=creationflags) mx._addSubprocess(self.process, self.args)
def start_gate_svm_server(args, err=sys.stderr): if os.path.exists(SERVER_LOG): os.remove(SERVER_LOG) args = [join(os.environ["MX_HOME"], "mx"), '-p', suite.dir, 'image_server_start', '-port=' + str(0), '-logFile=' + SERVER_LOG] + args mx.log("Starting image build server with: \n" + " ".join(args)) p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=err, preexec_fn=os.setsid) server_process_entry = mx._addSubprocess(p, args) # wait for the server to start retries = 20 port = None wait_time_s = 1 retrying_msg = "Retrying in " + str(wait_time_s) + " second..." while not port or not image_server_running(port): time.sleep(wait_time_s) if not port and exists(SERVER_LOG): try: with open(SERVER_LOG, 'r') as log_file: _, port_string, last = log_file.readline(), log_file.readline(), log_file.readline() if last.strip() == 'Accepting requests...': port = int(port_string.strip()) # port is printed on the second line else: mx.log("The image build server log exists but the server did not start yet.") mx.log(retrying_msg) except ValueError: mx.abort("The image build server did not start properly. Was the project built correctly?") else: mx.log("The image build server did not create a log file at: " + SERVER_LOG) mx.log(retrying_msg) retries -= 1 if retries is 0: mx.abort('The image build server does not respond to requests') print('Started image build server on port ' + str(port)) return server_process_entry, port
def __enter__(self): if mx._opts.verbose: mx.log(' '.join(['(background)'] + [pipes.quote(arg) for arg in self.args])) self.process = subprocess.Popen(self.args, start_new_session=True) mx._addSubprocess(self.process, self.args)
def __enter__(self): preexec_fn, creationflags = mx._get_new_progress_group_args() if mx._opts.verbose: mx.log(' '.join(['(background)'] + map(pipes.quote, self.args))) self.process = subprocess.Popen(self.args, preexec_fn=preexec_fn, creationflags=creationflags, stdout=FNULL, stderr=FNULL) mx._addSubprocess(self.process, self.args)