Skip to content

Commit 826be11

Browse files
committed
Adjust subprocess calls to use new text arg in migadmin.
Untested in practice so not ready for merge, yet. Follow-up to issue #288.
1 parent e30f612 commit 826be11

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

mig/shared/functionality/migadmin.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from mig.shared.accountreq import build_accountreqitem_object, \
3838
list_account_reqs, get_account_req, accept_account_req, \
3939
peer_account_req, reject_account_req
40-
from mig.shared.base import force_native_str_rec, force_native_str
40+
from mig.shared.base import force_native_str_rec
4141
from mig.shared.defaults import default_pager_entries, csrf_field, \
4242
keyword_any, keyword_auto, AUTH_CERTIFICATE, AUTH_OPENID_V2, \
4343
AUTH_OPENID_CONNECT
@@ -359,12 +359,13 @@ def main(client_id, user_arguments_dict, environ=None):
359359
'/sbin/sshd -f /etc/ssh/sshd_config-MiG-sftp-subsys')
360360
for proc in daemon_names:
361361
# NOTE: we use command list here to avoid shell requirement
362+
# NOTE: we want utf8-encoded output as text str for status below
362363
pgrep_proc = subprocess_popen(['pgrep', '-f', proc],
363364
stdout=subprocess_pipe,
364-
stderr=subprocess_stdout)
365+
stderr=subprocess_stdout,
366+
text=True)
365367
pgrep_proc.wait()
366-
# NOTE: output is system native encoding and we need native string
367-
ps_out = force_native_str(pgrep_proc.stdout.read().strip())
368+
ps_out = pgrep_proc.stdout.read().strip()
368369
if pgrep_proc.returncode == 0:
369370
daemons += "<div class='status_online'>%s running (pid %s)</div>" \
370371
% (proc, ps_out)
@@ -559,7 +560,7 @@ def main(client_id, user_arguments_dict, environ=None):
559560
'''})
560561

561562
# Finish tabs wrap
562-
output_objects.append({'object_type': 'html_form', 'text': '''
563+
output_objects.append({'object_type': 'html_form', 'text': '''
563564
</div>
564565
'''})
565566

0 commit comments

Comments
 (0)