Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process.cmdline should trim unnecessary trailing characters #6

Closed
giampaolo opened this issue May 23, 2014 · 6 comments
Closed

Process.cmdline should trim unnecessary trailing characters #6

giampaolo opened this issue May 23, 2014 · 6 comments

Comments

@giampaolo
Copy link
Owner

From [email protected] on January 27, 2009 15:36:49

What steps will reproduce the problem?  
>>> import psutil
>>> psutil.Process(4390).cmdline
['/bin/login', '--', '', '', '', '', '']
>>>

Original issue: http://code.google.com/p/psutil/issues/detail?id=6

@giampaolo
Copy link
Owner Author

From [email protected] on January 27, 2009 06:57:15

Another problem:

>>> import psutil
>>> psutil.Process(2).cmdline
['']

When cmdline is not available we should return an empty list "[]" instead.

@giampaolo
Copy link
Owner Author

From [email protected] on January 27, 2009 07:06:29

Both issues fixed as r71 .

Status: Fixed

@giampaolo
Copy link
Owner Author

From [email protected] on January 27, 2009 07:08:40

I would suggest doing this with a list comprehension instead: 

    cmdline = [x for x in f.read().split('\x00')[:-1] if x]

This solves both problems in less code and less operations.

@giampaolo
Copy link
Owner Author

From [email protected] on January 27, 2009 09:53:27

Labels: Milestone-0.1.0

@giampaolo
Copy link
Owner Author

From [email protected] on February 23, 2009 09:49:02

Labels: -Component-Library

@giampaolo
Copy link
Owner Author

From g.rodola on March 02, 2013 03:37:37

Updated csets after the SVN -> Mercurial migration: r71 == revision 38915f28fec1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant