file icon indicating copy to clipboard operation
file copied to clipboard

Inconsistent and incorrect behavior

Open bileslav opened this issue 2 years ago • 2 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?

bileslav avatar Aug 15 '22 14:08 bileslav

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

kelunik avatar Sep 08 '22 20:09 kelunik

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

kelunik avatar Sep 12 '22 07:09 kelunik