You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Forward host stdin to wp-cli through the server daemon
`echo foo | studio wp eval 'echo file_get_contents("php://stdin");'`
silently dropped input when the site was running (daemon path). Both
paths now drain process.stdin up-front and forward the bytes to
`php.cli({ stdin })`, which — paired with the Playground-side stdin
option — surfaces them to PHP via `php://stdin`.
- commands/wp.ts: `drainHostStdin()` reads a non-TTY process.stdin
into a Buffer and passes it to both the daemon (`sendWpCliCommand`)
and in-proc (`runWpCliCommand`/`runGlobalWpCliCommand`) paths.
- lib/types/wordpress-server-ipc.ts: wp-cli-command IPC payload gains
an optional `stdinBase64` field. Base64 is used because Node's
child_process IPC is JSON-serialized; we must preserve binary bytes
(e.g. gzipped SQL dumps) byte-for-byte.
- lib/wordpress-server-manager.ts: `sendWpCliCommand` accepts an
optional Buffer and base64-encodes it into the payload.
- lib/run-wp-cli-command.ts: in-proc `runWpCliCommand` /
`runGlobalWpCliCommand` accept an optional `{ stdin }` and
forward it to `php.cli()`.
- wordpress-server-child.ts: decode the base64 on the daemon side and
hand the bytes to `server.playground.cli(args, { stdin })`. Also
disable the sequential() dedup key whenever stdin is present —
piped stdin is inherently non-idempotent and two callers with
coincidentally equal byte lengths must not collapse into one
execution. The previous key included byte length only, which was
not enough.
No behavior change for commands invoked without piped stdin.
0 commit comments