Skip to content

Commit

Permalink
Short process name displays arguments (issue #609)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Jun 2, 2015
1 parent 4ff281c commit e350cb5
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions glances/plugins/glances_processlist.py
Expand Up @@ -280,13 +280,15 @@ def get_process_curses_data(self, p, first, args):
# If no command line for the process is available, fallback to
# the bare process name instead
cmdline = p['cmdline']
if cmdline == "" or args.process_short_name:
msg = ' {0}'.format(p['name'])
ret.append(self.curse_add_line(msg, splittable=True))
else:
try:
argument = ' '.join(cmdline.split()[1:])
try:
if cmdline == "" or args.process_short_name:
msg = ' {0}'.format(p['name'])
ret.append(self.curse_add_line(msg, decoration='PROCESS', splittable=True))
msg = ' {0}'.format(argument)
ret.append(self.curse_add_line(msg, splittable=True))
else:
cmd = cmdline.split()[0]
argument = ' '.join(cmdline.split()[1:])
path, basename = os.path.split(cmd)
if os.path.isdir(path):
msg = ' {0}'.format(path) + os.sep
Expand All @@ -295,10 +297,10 @@ def get_process_curses_data(self, p, first, args):
else:
msg = ' {0}'.format(basename)
ret.append(self.curse_add_line(msg, decoration='PROCESS', splittable=True))
msg = " {0}".format(argument)
msg = ' {0}'.format(argument)
ret.append(self.curse_add_line(msg, splittable=True))
except UnicodeEncodeError:
ret.append(self.curse_add_line("", splittable=True))
except UnicodeEncodeError:
ret.append(self.curse_add_line("", splittable=True))

# Add extended stats but only for the top processes
# !!! CPU consumption ???
Expand Down

0 comments on commit e350cb5

Please sign in to comment.