From 2d4dee498da0b5e0206331f4ee71949e2b357e83 Mon Sep 17 00:00:00 2001 From: yo Date: Thu, 24 Dec 2020 16:54:32 +0100 Subject: [PATCH] return binary return code with message --- control.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/control.py b/control.py index 22eab07..ae06f67 100644 --- a/control.py +++ b/control.py @@ -99,7 +99,7 @@ class QueueControl(object): :param str operation: Known operation from :attr:`pymailq.CONFIG`. :param list messages: List of :class:`~store.Mail` objects targetted for operation. - :return: Command's *stderr* output lines + :return: Command's *stderr* output lines, return code of binary :rtype: :func:`list` """ # validate that object's attribute "qid" exist. Raise AttributeError. @@ -135,7 +135,7 @@ class QueueControl(object): except BrokenPipeError: raise RuntimeError("Unexpected error: child process has crashed") - return [line.strip() for line in stderr.decode().split('\n')] + return [line.strip() for line in stderr.decode().split('\n')], child.returncode # smtpctl do not use stdin, have to call the binary for each message :-( else: @@ -153,11 +153,11 @@ class QueueControl(object): stdout, stderr = child.communicate() if not len(stdout): - return [line.strip() for line in stderr.decode().split('\n')] + return [line.strip() for line in stderr.decode().split('\n')], child.returncode result.append(stdout.decode()) - return result + return result, child.returncode, child.returncode def delete_messages(self, messages):