diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2015-08-26 08:58:03 -0700 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2015-08-26 08:58:03 -0700 |
| commit | b9823dbb3071d902753e713b0c32d027e73a7946 (patch) | |
| tree | 1e9c7b9631a43a70866a3b01a9d509f27d6f0956 /psutil/_pswindows.py | |
| parent | d592453854a6742c2e9efff25b5203d544853d7a (diff) | |
| download | psutil-b9823dbb3071d902753e713b0c32d027e73a7946.tar.gz | |
#650: make cmdline() handle unicode on python 2
Diffstat (limited to 'psutil/_pswindows.py')
| -rw-r--r-- | psutil/_pswindows.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/psutil/_pswindows.py b/psutil/_pswindows.py index 479cf770..3c86d994 100644 --- a/psutil/_pswindows.py +++ b/psutil/_pswindows.py @@ -315,7 +315,20 @@ class Process(object): @wrap_exceptions def cmdline(self): - return cext.proc_cmdline(self.pid) + ret = cext.proc_cmdline(self.pid) + if PY3: + return ret + else: + # On Python 2, if one or more bits of the cmdline is unicode + # we return a list of unicode strings. + new = [] + for x in ret: + x = py2_stringify(x) + if isinstance(x, unicode): + return ret + else: + new.append(x) + return new def ppid(self): try: |
