diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eb6617ed..1c73a1832 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `PipelineTask` now has a `has_finished()` method to indicate if the task has completed. If a task is never ran `has_finished()` will return False. +- `PipelineRunner` now supports SIGTERM. If received, the runner will be + canceled. + ### Fixed - Fixed an error closing local audio transports. diff --git a/src/pipecat/pipeline/runner.py b/src/pipecat/pipeline/runner.py index 47754d82f..df480648e 100644 --- a/src/pipecat/pipeline/runner.py +++ b/src/pipecat/pipeline/runner.py @@ -43,11 +43,15 @@ class PipelineRunner: loop = asyncio.get_running_loop() loop.add_signal_handler( signal.SIGINT, - lambda *args: asyncio.create_task(self._sigint_handler()) + lambda *args: asyncio.create_task(self._sig_handler()) + ) + loop.add_signal_handler( + signal.SIGTERM, + lambda *args: asyncio.create_task(self._sig_handler()) ) - async def _sigint_handler(self): - logger.warning(f"Ctrl-C detected. Canceling runner {self}") + async def _sig_handler(self): + logger.warning(f"Interruption detected. Canceling runner {self}") await self.cancel() def __str__(self):