fix conf parsing

This commit is contained in:
Alexey Avramov 2018-12-12 03:14:35 +09:00
parent 158404867f
commit 83c1fd1018
3 changed files with 6 additions and 8 deletions

View File

@ -194,6 +194,7 @@ Please create [issues](https://github.com/hakavlad/nohang/issues). Use cases, fe
- Print in terminal with colors - Print in terminal with colors
- Optimize limiting `oom_score_adj`: now it can works without UID=0 - Optimize limiting `oom_score_adj`: now it can works without UID=0
- Optimize GUI warnings: find env without run `ps` and `env` (partially implemented) - Optimize GUI warnings: find env without run `ps` and `env` (partially implemented)
- Fix conf parsing: use of `line.partition('=')` instead of `line.split('=')`
- Add `oom-sort` - Add `oom-sort`
- Add `oom-trigger` (partially implemented) - Add `oom-trigger` (partially implemented)

7
nohang
View File

@ -813,8 +813,8 @@ try:
etc = line.startswith('$ETC') etc = line.startswith('$ETC')
if not a and not b and not c and not d and not etc: if not a and not b and not c and not d and not etc:
a = line.split('=') a = line.partition('=')
config_dict[a[0].strip()] = a[1].strip() config_dict[a[0].strip()] = a[2].strip()
if etc: if etc:
a = line[4:].split('///') a = line[4:].split('///')
@ -1387,9 +1387,6 @@ if print_config:
print('avoid_re_uid: {}'.format(avoid_re_uid)) print('avoid_re_uid: {}'.format(avoid_re_uid))
print('avoid_uid_factor: {}'.format(avoid_uid_factor)) print('avoid_uid_factor: {}'.format(avoid_uid_factor))
print('\n5. The execution of a specific command instead of sending the\nSIGTERM signal\n') print('\n5. The execution of a specific command instead of sending the\nSIGTERM signal\n')
print('execute_the_command: {}'.format(execute_the_command)) print('execute_the_command: {}'.format(execute_the_command))
if execute_the_command: if execute_the_command:

View File

@ -167,9 +167,9 @@ avoid_factor = 3
# re_match_cmdline = True # re_match_cmdline = True
# this default pattern for prefer childs of chromium & firefox # this default pattern for prefer
prefer_re_cmdline = renderer|childID # childs of firefox and chromium
prefer_cmd_factor = 10 prefer_re_cmdline = -childID|--type=renderer
avoid_re_cmdline = ^/usr/lib/virtualbox avoid_re_cmdline = ^/usr/lib/virtualbox
avoid_cmd_factor = 3 avoid_cmd_factor = 3