amphp / file

An abstraction layer and non-blocking file access solution that keeps your application responsive.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Inconsistent and incorrect behavior

bileslav opened this issue · comments

require 'vendor/autoload.php';

$file = Amp\File\openFile('test.txt', 'a');
$file->write("test\n");
unset($file);

Revolt\EventLoop::run();
  1. When using default driver the execution hangs.
  2. When using eio driver the a mode behaves like w.
  3. When using uv driver it works but the file is not automatically closed in underlying destructors. I discovered this by encountering an anomalous chart of open file descriptors (similar code in a real module). Is it meant to be closed manually?

Thanks for reporting! I've committed fixes for 2 and 3. The fix for 1 is in amphp/byte-stream#100.

All of those have been fixed now in the beta versions, I still need to take a look at the current stable version.