Skip to content

Commit

Permalink
Electron processes displayed wrong in process list #1192
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Nov 25, 2017
1 parent ea6093c commit c799605
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
1 change: 1 addition & 0 deletions NEWS
Expand Up @@ -25,6 +25,7 @@ Bugs corrected:
* OS specific arguments should be documented and reported #1180
* 'ascii' codec can't encode character u'\U0001f4a9' in position 4: ordinal not in range(128) #1185
* KeyError: 'memory_info' on stats sum #1188
* Electron processes displayed wrong in process list #1192

Backward-incompatible changes:

Expand Down
21 changes: 10 additions & 11 deletions glances/plugins/glances_processlist.py
Expand Up @@ -20,10 +20,11 @@
"""Process list plugin."""

import os
import shlex
from datetime import timedelta

from glances.compat import iteritems
from glances.globals import LINUX, WINDOWS
from glances.globals import WINDOWS
from glances.logger import logger
from glances.processes import glances_processes, sort_stats
from glances.plugins.glances_core import Plugin as CorePlugin
Expand All @@ -43,16 +44,9 @@ def convert_timedelta(delta):

def split_cmdline(cmdline):
"""Return path, cmd and arguments for a process cmdline."""
path, cmd = os.path.split(cmdline[0])
arguments = ' '.join(cmdline[1:]).replace('\n', ' ')
# XXX: workaround for psutil issue #742
if LINUX and any(x in cmdline[0] for x in ('chrome', 'chromium')):
try:
exe, arguments = cmdline[0].split(' ', 1)
path, cmd = os.path.split(exe)
except ValueError:
arguments = None

cmdline_split = shlex.split(cmdline[0])
path, cmd = os.path.split(cmdline_split[0])
arguments = ' '.join(cmdline_split[1:])
return path, cmd, arguments


Expand Down Expand Up @@ -330,6 +324,11 @@ def get_process_curses_data(self, p, first, args):
try:
# XXX: remove `cmdline != ['']` when we'll drop support for psutil<4.0.0
if cmdline and cmdline != ['']:
# !!! DEBUG
logger.info(p['name'])
logger.info(cmdline)
logger.info(split_cmdline(cmdline))
# /!!!
path, cmd, arguments = split_cmdline(cmdline)
if os.path.isdir(path) and not args.process_short_name:
msg = ' {}'.format(path) + os.sep
Expand Down

0 comments on commit c799605

Please sign in to comment.