From 7db04ae00f297985efa72869186408d065049611 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=81=A5?= Date: Thu, 7 May 2020 10:42:14 +0800 Subject: [PATCH] fix 'swoole_set_process_name' not found error on cygwin platform --- src/Helpers/OS.php | 9 ++++++++- src/Server/Manager.php | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Helpers/OS.php b/src/Helpers/OS.php index d1541639..7a22a6fb 100644 --- a/src/Helpers/OS.php +++ b/src/Helpers/OS.php @@ -30,6 +30,13 @@ final class OS */ public const WIN = 'win'; + /** + * Cygwin + * + * @const string + */ + public const CYGWIN = 'cyg'; + /** * Returns true if current OS in types * @@ -51,4 +58,4 @@ public static function current(): string { return Str::substr(Str::lower(PHP_OS), 0, 3); } -} \ No newline at end of file +} diff --git a/src/Server/Manager.php b/src/Server/Manager.php index 0f751cf6..35e0c9c7 100644 --- a/src/Server/Manager.php +++ b/src/Server/Manager.php @@ -353,7 +353,7 @@ protected function clearCache() protected function setProcessName($process) { // MacOS doesn't support modifying process name. - if (OS::is(OS::MAC_OS) || $this->isInTesting()) { + if (OS::is(OS::MAC_OS, OS::CYGWIN) || $this->isInTesting()) { return; } $serverName = 'swoole_http_server';