def test__terminates_with_kill_and_killpg(self):
protocol = SignalPrinterProtocol()
process = yield self.startSignalPrinter(protocol, pgrp=True)
# Capture the pid now; it gets cleared when the process exits.
pid = process.pid
# Terminate and wait for it to exit.
self.terminateSignalPrinter(process, protocol)
yield protocol.done.addErrback(suppress, ProcessTerminated)
# os.kill was called once then os.killpg was called twice because the
# subprocess made itself a process group leader.
self.assertThat(
twisted_module._os_kill, MockCallsMatch(
mock.call(pid, signal.SIGTERM),
))
self.assertThat(
twisted_module._os_killpg, MockCallsMatch(
mock.call(pid, signal.SIGQUIT),
mock.call(pid, signal.SIGKILL),
))
评论列表
文章目录