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
{{ message }}
Repository navigation
Output piped to another command is cut off after 64 KiB #228
When stdout is a pipe, Node writes to it asynchronously, and run() calls process.exit() as soon as the result has been logged. Whatever the pipe has not yet taken is lost, so a command whose output is larger than the pipe's buffer (64 KiB on Linux) is cut off, silently and with exit code 0. That includes the README's setup for piping into jq:
$ node cli.mjs big | wc -c
131072
$ node cli.mjs big | (sleep 1; wc -c)
65536
The whole output is 1,000,001 bytes. This is trpc-cli 0.17.1 on Node 26.12, Linux. Node's docs for process.exit() describe the cause: "writes to process.stdout in Node.js are sometimes asynchronous and may occur over multiple ticks of the Node.js event loop".
Errors are cut off the same way, since run() logs the error and then exits: a command that throws an Error with a 1,000,000-character message, its stderr piped through (sleep 1; wc -c), delivers 65,536 bytes.
Exiting once the streams have drained fixes it. With the documented process.exit override below, all 1,000,001 bytes arrive; run() could do the same for stdout and stderr before it exits.
Activity
pullfrog commentedon Oct 23, 2026