(self)
return self._name
The process name. The return value is cached after first call.
The process name. The return value is cached after first call.
The process name . The return value is cached after first call .
def name(self):
        """The process name. The return value is cached after first call."""
        if self._name is None:
            name = self._proc.name()
            if _POSIX and len(name) >= 15:
                # On UNIX the name gets truncated to the first 15 characters.
                # If it matches the first part of the cmdline we return that
                # one instead because it's usually more explicative.
                # Examples are "gnome-keyring-d" vs. "gnome-keyring-daemon".
                try:
                    cmdline = self.cmdline()
                except AccessDenied:
                    pass
                else:
                    if cmdline:
                        extended_name = os.path.basename(cmdline[0])
                        if extended_name.startswith(name):
                            name = extended_name
            self._proc._name = name
            self._name = name
        return self._name
def name ( self ) : if self . _name is None : name = self . _proc . name ( ) if _POSIX and len ( name ) >= 15 : # On UNIX the name gets truncated to the first 15 characters. # If it matches the first part of the cmdline we return that # one instead because it's usually more explicative. # Examples are "gnome-keyring-d" vs. "gnome-keyring-daemon". try : cmdline = self . cmdline ( ) except AccessDenied : pass else : if cmdline : extended_name = os . path . basename ( cmdline [ 0 ] ) if extended_name . startswith ( name ) : name = extended_name self . _proc . _name = name self . _name = name return self . _name