aboutsummaryrefslogtreecommitdiffhomepage
path: root/crates/shirabe-php-rpc/php/worker.php
diff options
context:
space:
mode:
Diffstat (limited to 'crates/shirabe-php-rpc/php/worker.php')
-rw-r--r--crates/shirabe-php-rpc/php/worker.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/shirabe-php-rpc/php/worker.php b/crates/shirabe-php-rpc/php/worker.php
index e82c45ba..092f535f 100644
--- a/crates/shirabe-php-rpc/php/worker.php
+++ b/crates/shirabe-php-rpc/php/worker.php
@@ -427,10 +427,14 @@ final class ShirabeRpcRuntime
}
}
-$client = @stream_socket_client('unix://' . $argv[1], $errno, $errstr);
+// The socket is one end of a socketpair the parent installed on this descriptor before exec;
+// there is nothing to connect to. See docs/dev/php-rpc.md.
+$client = @fopen('php://fd/' . $argv[1], 'r+b');
if ($client === false) {
exit(1);
}
+// Frames must reach the parent as they are written, not when a buffer happens to fill.
+stream_set_write_buffer($client, 0);
ShirabeRpcRuntime::$socket = $client;
ShirabeRpcRuntime::$stubsDir = $argv[2] ?? null;