Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The write function blocks the completion of Eventloop::Run() #82

Open
PhantomArt opened this issue Jan 15, 2024 · 3 comments
Open

The write function blocks the completion of Eventloop::Run() #82

PhantomArt opened this issue Jan 15, 2024 · 3 comments

Comments

@PhantomArt
Copy link

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.

@kelunik
Copy link
Member

kelunik commented Jan 15, 2024

Do you use the latest versions?

@PhantomArt
Copy link
Author

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"
    }
}

@PhantomArt
Copy link
Author

I ran the same test on PHP 8.2.13 on Linux, there is no problem there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants
@kelunik @PhantomArt and others