From ea5a6d301fb5f799aa24012c5bce3032d7761180 Mon Sep 17 00:00:00 2001 From: "ljf (zamentur)" Date: Sun, 23 May 2021 20:09:48 +0200 Subject: [PATCH] [fix] Email on certificate renewing failed (#1227) * [fix] Email on certificate renewing failed * [enh] Use check_output instead of subprocess * Update src/yunohost/certificate.py Co-authored-by: Kayou * [mod] Use f-string for readability Co-authored-by: Kayou Co-authored-by: Alexandre Aubin --- src/yunohost/certificate.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/src/yunohost/certificate.py b/src/yunohost/certificate.py index c01bff84e..633877d7c 100644 --- a/src/yunohost/certificate.py +++ b/src/yunohost/certificate.py @@ -949,11 +949,5 @@ def _name_self_CA(): def _tail(n, file_path): - stdin, stdout = os.popen2("tail -n %s '%s'" % (n, file_path)) - - stdin.close() - - lines = stdout.readlines() - stdout.close() - - return "".join(lines) + from moulinette.utils.process import check_output + return check_output(f"tail -n {n} '{file_path}'")