amphp / process

An async process dispatcher for Amp.
MIT License
229 stars 32 forks source link

SocketConnector fails to close sockets on PHP8/Win #48

Closed Bilge closed 3 years ago

Bilge commented 3 years ago

This code is prone to throwing TypeErrors in PHP 8.0.3/Windows:

https://github.com/amphp/process/blob/a9823125177bf8247af7cde28c24e511bc4260c0/lib/Internal/Windows/SocketConnector.php#L313

Fatal error: Uncaught TypeError: fclose(): supplied resource is not a valid stream resource in amphp\process\lib\Internal\Windows\SocketConnector.php:313 Stack trace:

0 amphp\process\lib\Internal\Windows\SocketConnector.php(313): fclose(Resource id #176)

1 amphp\amp\lib\Loop\NativeDriver.php(321): Amp\Process\Internal\Windows\SocketConnector->onReadableExitCode('t', Resource id #176, Object(Amp\Process\Internal\Windows\Handle))

2 amphp\amp\lib\Loop\NativeDriver.php(127): Amp\Loop\NativeDriver->selectStreams(Array, Array, 4.963)