mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
use terminate not kill (#3750)
This commit is contained in:
parent
ca9b3f18af
commit
fd95a55054
2 changed files with 3 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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__":
|
||||
|
|
|
|||
Loading…
Reference in a new issue