1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

ubuntu fixes

This commit is contained in:
Kelly Brazil
2019-10-18 12:57:02 -07:00
parent cec73d6131
commit c04895407f
2 changed files with 6 additions and 4 deletions

View File

@ -7,6 +7,7 @@ jc changelog
- Fix netstat -p parsing for Ubuntu - Fix netstat -p parsing for Ubuntu
- Use maxsplit option in split in ls.py line 109... otherwise filenames with multiple spaces - Use maxsplit option in split in ls.py line 109... otherwise filenames with multiple spaces
between words can be incorrectly represented with the .join operation between words can be incorrectly represented with the .join operation
- Use list(filter(None, cleandata)) or list comprehension to clean any blank entries in ls.py line 98
20191017 v0.2.0 20191017 v0.2.0
- ifconfig, ls, and netstat support - ifconfig, ls, and netstat support

View File

@ -166,13 +166,14 @@ def parse_line(entry):
if len(parsed_line) > 5: if len(parsed_line) > 5:
if parsed_line[5][0] not in string.digits: if parsed_line[5][0] not in string.digits and parsed_line[5][0] != '-':
output_line['state'] = parsed_line[5] output_line['state'] = parsed_line[5]
if len(parsed_line) > 6: if len(parsed_line) > 6 and parsed_line[6][0] in string.digits:
output_line['pid'] = int(parsed_line[6].split('/')[0]) output_line['pid'] = int(parsed_line[6].split('/')[0])
output_line['program_name'] = parsed_line[6].split('/')[1] output_line['program_name'] = parsed_line[6].split('/')[1]
else: else:
if parsed_line[5][0] in string.digits:
output_line['pid'] = int(parsed_line[5].split('/')[0]) output_line['pid'] = int(parsed_line[5].split('/')[0])
output_line['program_name'] = parsed_line[5].split('/')[1] output_line['program_name'] = parsed_line[5].split('/')[1]