mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-01-18 18:56:28 +00:00
add a helper for vigorously cleaning up processes
This commit is contained in:
parent
19e03bbff0
commit
cec31e6e5a
@ -105,6 +105,26 @@ class _MagicTextProtocol(ProcessProtocol):
|
||||
sys.stdout.write(data)
|
||||
|
||||
|
||||
def _cleanup_twistd_process(twistd_process, exited):
|
||||
"""
|
||||
Terminate the given process with a kill signal (SIGKILL on POSIX,
|
||||
TerminateProcess on Windows).
|
||||
|
||||
:param twistd_process: The `IProcessTransport` representing the process.
|
||||
:param exited: A `Deferred` which fires when the process has exited.
|
||||
|
||||
:return: After the process has exited.
|
||||
"""
|
||||
try:
|
||||
print("signaling {} with KILL".format(twistd_process.pid))
|
||||
twistd_process.signalProcess('KILL')
|
||||
print("signaled, blocking on exit")
|
||||
pytest_twisted.blockon(exited)
|
||||
print("exited, goodbye")
|
||||
except ProcessExitedAlready:
|
||||
pass
|
||||
|
||||
|
||||
def _run_node(reactor, node_dir, request, magic_text):
|
||||
if magic_text is None:
|
||||
magic_text = "client running"
|
||||
|
Loading…
Reference in New Issue
Block a user