From ebec7d98c8736b1b906a12ea8ba623983f764df8 Mon Sep 17 00:00:00 2001 From: Ray Walker Date: Sat, 3 Oct 2026 19:03:39 +1000 Subject: [PATCH] docs(readme): warn that a command reading stdin caches empty output A command that reads stdin gets nothing under ck run and, if it exits 0, its empty output is cached silently. Show the trap and the fix: wrap the producer of a pipeline, not its consumer. --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 1f3a4d3..9591702 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,13 @@ shell. Pass input in arguments, files or `--scope` instead. Programs that prompt by opening the terminal themselves, as `op`, `ssh` and `sudo` do, still reach you. +A command that reads its input from stdin, such as `jq`, `envsubst` or +`python3 -`, therefore reads nothing. If it still exits 0, ck caches that +output like any other, with no warning: `curl -s "$URL" | ck run -- jq -r .token` +caches an empty token. To cache a pipeline, wrap the command that produces the +input instead: `ck run --ttl 5m -- curl -s "$URL" | jq -r .token` caches curl's +output and runs `jq` on it every time. + ### What the key does not cover The key is the command and its arguments, plus `--scope`. It does not cover