mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-06-23 09:15:32 +00:00
add a helper for vigorously cleaning up processes
This commit is contained in:
@ -105,6 +105,26 @@ class _MagicTextProtocol(ProcessProtocol):
|
|||||||
sys.stdout.write(data)
|
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):
|
def _run_node(reactor, node_dir, request, magic_text):
|
||||||
if magic_text is None:
|
if magic_text is None:
|
||||||
magic_text = "client running"
|
magic_text = "client running"
|
||||||
|
Reference in New Issue
Block a user