diff --git a/certbot/plugins/manual.py b/certbot/plugins/manual.py index 48aec6e35..c124ce048 100644 --- a/certbot/plugins/manual.py +++ b/certbot/plugins/manual.py @@ -3,7 +3,6 @@ import os import logging import pipes import shutil -import signal import socket import subprocess import sys @@ -233,7 +232,7 @@ s.serve_forever()" """ "cleanup() must be called after perform()") if self._httpd.poll() is None: logger.debug("Terminating manual command process") - os.killpg(self._httpd.pid, signal.SIGTERM) + self._httpd.terminate() else: logger.debug("Manual command process already terminated " "with %s code", self._httpd.returncode) diff --git a/certbot/plugins/manual_test.py b/certbot/plugins/manual_test.py index 25107e4b4..828281951 100644 --- a/certbot/plugins/manual_test.py +++ b/certbot/plugins/manual_test.py @@ -1,5 +1,4 @@ """Tests for certbot.plugins.manual.""" -import signal import unittest import mock @@ -123,13 +122,12 @@ class AuthenticatorTest(unittest.TestCase): httpd.poll.return_value = 0 self.auth_test_mode.cleanup(self.achalls) - @mock.patch("certbot.plugins.manual.os.killpg", autospec=True) - def test_cleanup_test_mode_kills_still_running(self, mock_killpg): + def test_cleanup_test_mode_kills_still_running(self): # pylint: disable=protected-access self.auth_test_mode._httpd = httpd = mock.Mock(pid=1234) httpd.poll.return_value = None self.auth_test_mode.cleanup(self.achalls) - mock_killpg.assert_called_once_with(1234, signal.SIGTERM) + httpd.terminate.assert_called_once_with() if __name__ == "__main__":