The write function blocks the completion of Eventloop::Run()
PhantomArt opened this issue · comments
I'm running the following code:
write('file.txt', 'text');
EventLoop::run(); // it never ends
Writing the file works as expected, the script hangs on the EventLoop::run()
call. I have a Windows operating system. I didn't install any additional extensions for event loop.
I only see this problem when using the write
function. I don't see this problem when I use Amp\Http, including when I run asynchronous operations using the async
function. The problem also disappears if I replace write
with file_put_contents
.
Do you use the latest versions?
I have PHP 8.2.5. I created a new folder and ran:
composer require amphp/file
composer require amphp/http-client
After this I create a new file with the following content:
<?php
require __DIR__ . '/vendor/autoload.php';
Amp\File\write('file.txt', 'text');
Revolt\EventLoop::run(); // it never ends
The contents of composer.json
look like this:
{
"require": {
"amphp/file": "^3.0",
"amphp/http-client": "^5.0"
}
}
I ran the same test on PHP 8.2.13 on Linux, there is no problem there.