def _start_process(self): path = getattr(self, "PROCESS_PATH", os.path.join(cfg.EXEC_PREFIX, self.PROCESS_NAME)) flags = getattr(self, "FLAGS", []) kws = {} if not options.is_verbose(): FNULL = open('/dev/null', 'w') kws = {'stdout': FNULL, 'stderr': FNULL} command = [path] + flags log("Starting %s" % ' '.join(command)) return subprocess.Popen([path] + flags, **kws)
def _start_process(self): path = getattr(self, "PROCESS_PATH", os.path.join(cfg.EXEC_PREFIX, self.PROCESS_NAME)) flags = getattr(self, "FLAGS", []) if options.is_manual_start(): print ("Start %s manually" % self.PROCESS_NAME) else: kws = {} if not options.is_verbose(): FNULL = open("/dev/null", "w") kws = {"stdout": FNULL, "stderr": FNULL} return subprocess.Popen([path] + flags, **kws)
def _start_process(self): path = getattr(self, "PROCESS_PATH", os.path.join(cfg.EXEC_PREFIX, self.PROCESS_NAME)) flags = getattr(self, "FLAGS", []) if options.is_manual_start(): print("Start %s manually" % self.PROCESS_NAME) else: kws = {} if not options.is_verbose(): FNULL = open('/dev/null', 'w') kws = {'stdout': FNULL, 'stderr': FNULL} return subprocess.Popen([path] + flags, **kws)
def _start_process(self): path = self.PROCESS_PATH flags = getattr(self, "FLAGS", []) kws = {} if not options.is_verbose(): FNULL = open('/dev/null', 'w') kws = {'stdout': FNULL, 'stderr': FNULL} command = [path] + flags log("Starting %s" % ' '.join(command)) try: return subprocess.Popen([path] + flags, **kws) except OSError as e: raise RuntimeError("Error starting %s: %s" % (path, e))
def _start_process (self): path = getattr (self, "PROCESS_PATH", os.path.join (cfg.EXEC_PREFIX, self.PROCESS_NAME)) flags = getattr (self, "FLAGS", []) kws = {} if not options.is_verbose (): FNULL = open ('/dev/null', 'w') kws = { 'stdout': FNULL, 'stderr': FNULL } command = [path] + flags log ("Starting %s" % ' '.join(command)) return subprocess.Popen ([path] + flags, **kws)
def _stop_process (self): if options.is_manual_start (): if self.available: log ("Kill %s manually" % self.PROCESS_NAME) self.loop.run () else: control_binary = os.path.join (cfg.BINDIR, "tracker-control") kws = {} if not options.is_verbose (): FNULL = open ('/dev/null', 'w') kws = { 'stdout': FNULL } subprocess.call ([control_binary, "--kill=miners"], **kws) return False
def _stop_process(self): if options.is_manual_start(): if self.available: log("Kill %s manually" % self.PROCESS_NAME) self.loop.run() else: control_binary = os.path.join(cfg.BINDIR, "tracker-control") kws = {} if not options.is_verbose(): FNULL = open('/dev/null', 'w') kws = {'stdout': FNULL} subprocess.call([control_binary, "--kill=miners"], **kws) return False
def _process_watch_cb (self): if self.process_watch_timeout == 0: # The GLib seems to call the timeout after we've removed it # sometimes, which causes errors unless we detect it. return False status = self.process.poll () if status is None: return True # continue elif status == 0 and not self.abort_if_process_exits_with_status_0: return True # continue else: self.process_watch_timeout = 0 if options.is_verbose(): error = "" else: error = self.process.stderr.read() raise RuntimeError("%s exited with status: %i\n%s" % (self.PROCESS_NAME, status, error))
def log (message): if options.is_verbose (): print (message)