summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-10-10 08:59:28 -0700
committerGitHub <noreply@github.com>2018-10-10 08:59:28 -0700
commitac3129c80d72825464eb018c7f9a02f31fc68d98 (patch)
tree6e48b3c11966ab4e9e878c63d05b5ee4e9ab4cca
parent34b3805c1ff6532eb7c86cfea3508b1372de005f (diff)
parent5df7871f11dd694d45aad89f28a680cb46e57c52 (diff)
Merge pull request #1306 from lucc/fix-1303
Check the return code from sendmail
-rw-r--r--alot/account.py6
-rw-r--r--tests/account_test.py1
2 files changed, 5 insertions, 2 deletions
diff --git a/alot/account.py b/alot/account.py
index f8438564..c8f3c09a 100644
--- a/alot/account.py
+++ b/alot/account.py
@@ -348,7 +348,11 @@ class SendmailAccount(Account):
try:
# make sure self.mail is a string
- out, *_ = await call_cmd_async(cmdlist, stdin=str(mail))
+ out, err, code = await call_cmd_async(cmdlist, stdin=str(mail))
+ if code != 0:
+ msg = 'The sendmail command {} returned with code {}{}'.format(
+ self.cmd, code, ':\n' + err.strip() if err else '.')
+ raise Exception(msg)
except Exception as e:
logging.error(str(e))
raise SendingMailFailed(str(e))
diff --git a/tests/account_test.py b/tests/account_test.py
index d78ebb13..c1fca557 100644
--- a/tests/account_test.py
+++ b/tests/account_test.py
@@ -168,7 +168,6 @@ class TestSend(unittest.TestCase):
#self.assertIn(cm.output, "sent mail successfullya")
self.assertIn("INFO:root:sent mail successfully", cm.output)
- @unittest.expectedFailure
@utilities.async_test
async def test_failing_sendmail_command_is_noticed(self):
a = account.SendmailAccount(address="test@alot.dev", cmd="false")