X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;ds=sidebyside;f=test%2Ftest-lib.sh;h=2f7d6cd181c82e4ec5df559b7046171e5f23ad8d;hb=b7f7b573e4bf3d00d9e887bc1aee264722d22778;hp=568e89f18024cc8e4350236e8ca0eb3dad3dd4c9;hpb=f96ddb15f8d0145e1b877eb821e63d36dbabc71a;p=notmuch diff --git a/test/test-lib.sh b/test/test-lib.sh index 568e89f1..2f7d6cd1 100644 --- a/test/test-lib.sh +++ b/test/test-lib.sh @@ -403,8 +403,11 @@ emacs_deliver_message () shift 2 # before we can send a message, we have to prepare the FCC maildir mkdir -p "$MAIL_DIR"/sent/{cur,new,tmp} - $TEST_DIRECTORY/smtp-dummy sent_message & - smtp_dummy_pid=$! + # eval'ing smtp-dummy --background will set smtp_dummy_pid + smtp_dummy_pid= + eval `$TEST_DIRECTORY/smtp-dummy --background sent_message` + test -n "$smtp_dummy_pid" || return 1 + test_emacs \ "(let ((message-send-mail-function 'message-smtpmail-send-it) (smtpmail-smtp-server \"localhost\") @@ -419,9 +422,11 @@ emacs_deliver_message () (insert \"${body}\") $@ (message-send-and-exit))" - # opportunistically quit smtp-dummy in case above fails. - { echo QUIT > /dev/tcp/localhost/25025; } 2>/dev/null - wait ${smtp_dummy_pid} + + # In case message was sent properly, client waits for confirmation + # before exiting and resuming control here; therefore making sure + # that server exits by sending (KILL) signal to it is safe. + kill -9 $smtp_dummy_pid notmuch new >/dev/null }