From 06db2fee3aa16056a79cbfc1dfd52339538a0307 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=91=E6=9E=97?= Date: Fri, 17 Jun 2022 13:55:46 +0800 Subject: [PATCH] modify plugin name --- Abstracts/BaseProcess.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Abstracts/BaseProcess.php b/Abstracts/BaseProcess.php index 1e7d7c5..f563f37 100644 --- a/Abstracts/BaseProcess.php +++ b/Abstracts/BaseProcess.php @@ -90,14 +90,15 @@ abstract class BaseProcess implements OnProcessInterface public function onSigterm(): static { if (!Context::inCoroutine()) { - Process::signal(SIGTERM, fn($data) => $this->onShutdown($data)); + Process::signal(SIGTERM | SIGINT, fn($data) => $this->onShutdown($data)); } else { - Coroutine::create(function () { - $data = Coroutine::waitSignal(SIGTERM, -1); + $listen = function () { + $data = Coroutine::waitSignal(SIGTERM | SIGINT, -1); if ($data) { $this->onShutdown($data); } - }); + }; + Coroutine::create($listen); } return $this; }