From 2095c0d5793fd6d24fbbe56a239de7da0cc57ef5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mr=C2=B7x?= Date: Mon, 19 Apr 2021 14:52:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HttpServer/Shutdown.php | 5 ++--- System/Snowflake.php | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/HttpServer/Shutdown.php b/HttpServer/Shutdown.php index e70b53e0..93f2e37a 100644 --- a/HttpServer/Shutdown.php +++ b/HttpServer/Shutdown.php @@ -47,9 +47,8 @@ class Shutdown extends Component public function shutdown(): void { clearstatcache(storage()); - $output = shell_exec('ls -alh /.dockerenv'); - var_dump($output); - if (!empty($output)) { + $output = shell_exec('[ -f /.dockerenv ] && echo yes || echo no'); + if ($output === 'yes') { return; } diff --git a/System/Snowflake.php b/System/Snowflake.php index 2a8d2d56..d5e31706 100644 --- a/System/Snowflake.php +++ b/System/Snowflake.php @@ -243,8 +243,8 @@ class Snowflake */ public static function isDcoker(): bool { - exec('ls -alh /.dockerenv', $output, $cod); - if ($cod === 0 && !empty($output)) { + exec('[ -f /.dockerenv ] && echo yes || echo no', $output, $cod); + if ($cod === 0 && $output === 'yes') { return true; } return false;