From 3db9dcd9ec4b10775766d0ad1d4b263030e7fe4c Mon Sep 17 00:00:00 2001 From: Oleksii Shevchuk Date: Thu, 16 Mar 2017 17:50:22 +0200 Subject: [PATCH] Fix ps -t output in windows --- pupy/modules/ps.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pupy/modules/ps.py b/pupy/modules/ps.py index a60b9355..46be303e 100644 --- a/pupy/modules/ps.py +++ b/pupy/modules/ps.py @@ -15,7 +15,7 @@ def gen_columns(record, colinfo): columns['name'] = record.get('name') or '?' columns['cmdline'] = ' '.join([ x for x in record['cmdline'][1:] if x.strip() - ]) if 'cmdline' in record else '' + ]) if record.get('cmdline') else '' columns['exe'] = record.get('exe') or '{{{}}}'.format(columns['name']) columns['username'] = record.get('username') or '' cpu = record.get('cpu_percent') @@ -92,6 +92,7 @@ def print_pstree(fout, parent, tree, data, prefix=indent+('┌' if first else '├'), indent=indent + '│ ', width=width, colinfo=colinfo, info=info, hide=hide ) + first = False child = tree[parent][-1] print_pstree( @@ -123,6 +124,7 @@ class PsModule(PupyModule): """ list processes """ dependencies = [ 'pupyps' ] + is_module=False def init_argparse(self): self.arg_parser = PupyArgumentParser(prog="ps", description=self.__doc__)