コード例 #1
0
ファイル: helpers.py プロジェクト: saifulbkhan/tracker-miners
    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)
コード例 #2
0
ファイル: helpers.py プロジェクト: plundstr/tracker
    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)
コード例 #3
0
    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)
コード例 #4
0
ファイル: helpers.py プロジェクト: chendonghai01/tracker
    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))
コード例 #5
0
ファイル: helpers.py プロジェクト: anantkaushik89/tracker
    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)
コード例 #6
0
ファイル: helpers.py プロジェクト: Pelagicore/tracker-ivi
    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
コード例 #7
0
    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
コード例 #8
0
ファイル: helpers.py プロジェクト: marco-c/tracker
    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))
コード例 #9
0
ファイル: helpers.py プロジェクト: marco-c/tracker
def log (message):
    if options.is_verbose ():
        print (message)
コード例 #10
0
ファイル: helpers.py プロジェクト: anantkaushik89/tracker
def log (message):
    if options.is_verbose ():
        print (message)