1
0
mirror of https://github.com/danog/file.git synced 2025-01-22 13:21:13 +01:00

Fix touch on non-existent files in uv / eio drivers

Fixes #73.
This commit is contained in:
Niklas Keller 2023-07-23 20:54:06 +02:00
parent c2313ea280
commit efeb737b1f
No known key found for this signature in database
GPG Key ID: AFA536ABA90C76A6
3 changed files with 11 additions and 0 deletions

View File

@ -313,6 +313,10 @@ final class EioFilesystemDriver implements FilesystemDriver
$modificationTime = $modificationTime ?? \time();
$accessTime = $accessTime ?? $modificationTime;
if (!$this->getStatus($path)) {
$this->openFile($path, 'c')->close();
}
$deferred = new DeferredFuture;
$this->poll->listen();

View File

@ -363,6 +363,10 @@ final class UvFilesystemDriver implements FilesystemDriver
$modificationTime = $modificationTime ?? \time();
$accessTime = $accessTime ?? $modificationTime;
if (!$this->getStatus($path)) {
$this->openFile($path, 'c')->close();
}
$deferred = new DeferredFuture;
$this->poll->listen();

View File

@ -504,6 +504,9 @@ abstract class FilesystemDriverTest extends FilesystemTest
$this->assertTrue($newStat["atime"] > $oldStat["atime"]);
$this->assertTrue($newStat["mtime"] > $oldStat["mtime"]);
$this->driver->touch($touch);
self::assertFileExists($touch);
}
/**