def __select_process(self):
        """Returns the proces id of a running process that fulfills the match criteria.

        This will either use the commandline matcher or the target pid to find the process.
        If no process is matched, None is returned.

        @return: The process id of the matching process, or None
        @rtype: int or None
        """
        sub_proc = None
        if self.__commandline_matcher is not None:
            try:
                # Spawn a process to run ps and match on the command line.  We only output two
                # fields from ps.. the pid and command.
                sub_proc = Popen(['ps', 'ax', '-o', 'pid,command'],
                                 shell=False, stdout=PIPE)

                sub_proc.stdout.readline()
                for line in sub_proc.stdout:
                    line = line.strip()
                    if line.find(' ') > 0:
                        pid = int(line[:line.find(' ')])
                        line = line[(line.find(' ') + 1):]
                        if re.search(self.__commandline_matcher, line) is not None:
                            return pid
                return None
            finally:
                # Be sure to wait on the spawn process.
                if sub_proc is not None:
                    sub_proc.wait()
        else:
            # See if the specified target pid is running.  If so, then return it.
            try:
                # Special case '$$' to mean this process.
                if self.__target_pid > '$$':
                    pid = os.getpid()
                else:
                    pid = int(self.__target_pid)
                os.kill(pid, 0)
                return pid
            except OSError:
                # If we get this, it means we tried to signal a process we do not have permission to signal.
                # If this is the case, we won't have permission to read its stats files either, so we ignore it.
                return None
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/builtin_monitors/linux_process_metrics.py/ProcessMonitor.__select_process/operator `==` -> `>`