diff --git a/src/PocketMine.php b/src/PocketMine.php index ddaa3bcc3..530815eb6 100644 --- a/src/PocketMine.php +++ b/src/PocketMine.php @@ -281,6 +281,8 @@ namespace pocketmine { echo Terminal::$FORMAT_RESET . PHP_EOL; + Filesystem::releaseLockFile($lockFilePath); + exit($exitCode); } diff --git a/src/utils/Filesystem.php b/src/utils/Filesystem.php index 7709deb5f..6a9068bdd 100644 --- a/src/utils/Filesystem.php +++ b/src/utils/Filesystem.php @@ -46,6 +46,7 @@ use const DIRECTORY_SEPARATOR; use const LOCK_EX; use const LOCK_NB; use const LOCK_SH; +use const LOCK_UN; use const SCANDIR_SORT_NONE; final class Filesystem{ @@ -140,6 +141,7 @@ final class Filesystem{ throw new \InvalidArgumentException("Invalid lock file path"); } if(isset(self::$lockFileHandles[$lockFilePath])){ + flock(self::$lockFileHandles[$lockFilePath], LOCK_UN); fclose(self::$lockFileHandles[$lockFilePath]); unset(self::$lockFileHandles[$lockFilePath]); @unlink($lockFilePath);