From 9be4cee95d07b986ac28444546ef1c853b411df8 Mon Sep 17 00:00:00 2001 From: wpjscc <76907477+wpjscc@users.noreply.github.com> Date: Mon, 21 Oct 2024 07:39:23 +0800 Subject: [PATCH] fix the putContents function cannot override the file content in uv. --- src/Uv/File.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Uv/File.php b/src/Uv/File.php index f423ef9b..b4d285b1 100644 --- a/src/Uv/File.php +++ b/src/Uv/File.php @@ -57,7 +57,7 @@ public function putContents(string $contents, int $flags = 0) uv_fs_open( $this->uvLoop, $this->path . DIRECTORY_SEPARATOR . $this->name, - (($flags & \FILE_APPEND) == \FILE_APPEND) ? UV::O_RDWR | UV::O_CREAT | UV::O_APPEND : UV::O_RDWR | UV::O_CREAT, + (($flags & \FILE_APPEND) == \FILE_APPEND) ? UV::O_RDWR | UV::O_CREAT | UV::O_APPEND : UV::O_RDWR | UV::O_CREAT | UV::O_TRUNC, 0644, function ($fileDescriptor) use ($resolve, $contents, $flags): void { uv_fs_write($this->uvLoop, $fileDescriptor, $contents, 0, function ($fileDescriptor, int $bytesWritten) use ($resolve): void {