From e1c3042eba5989f7db537ceda2766e08c15f9b59 Mon Sep 17 00:00:00 2001 From: Kevin Pulo Date: Thu, 11 Apr 2013 21:57:55 +1000 Subject: [PATCH] Correctly wait for the MTA to finish before exiting. And use the MTA's exit code as our own (so that the various possible error states are correctly reported to the MUA). --- attachcheck | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/attachcheck b/attachcheck index e5ac549..e633291 100755 --- a/attachcheck +++ b/attachcheck @@ -58,9 +58,11 @@ def send_message(): cmd[0] = sendmail from subprocess import Popen, PIPE - mailpipe = Popen(cmd, stdin=PIPE).stdin + process = Popen(cmd, stdin=PIPE) + mailpipe = process.stdin mailpipe.write( message_string ) - sys.exit( mailpipe.close() ) + mailpipe.close() + sys.exit( process.wait() ) ## SUB: print error message def print_error(): -- 2.39.5