fix: run deltachat-rpc-server in its own process group

This ensures the server does not get SIGINT
when the bot is running in a terminal and user presses ^C
We want to send SIGTERM ourselves after clean shutdown,
e.g. stopping I/O for all accounts.
This commit is contained in:
link2xt
2023-10-06 18:30:59 +00:00
parent 7bf44a237e
commit 95571be278

View File

@@ -39,6 +39,10 @@ class Rpc:
"deltachat-rpc-server",
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
# Prevent subprocess from capturing SIGINT.
# We are not using `process_group`
# because it is not supported before Python 3.11.
preexec_fn=os.setpgrp,
**self._kwargs,
)
self.id = 0