Send progress output to stderr, so stdout carries only a command's own output #48
Labels
No labels
bug
claude:blocked
claude:done
claude:failed
claude:in-progress
claude:ready
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Catcrafts/Crafter.Build#48
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
crafter-build writes its progress to stdout:
Progress.cpp:70decides whether there is a terminal withisatty(STDOUT_FILENO)(and line 26 takes the width from stdout).[n/m] labelto stdout (Progress.cpp:99). So do the closing "Built N steps in Xms" line and the-vcommand echo (EchoCommand,Progress.cpp:104).ScriptContext::Runechoes$ cmdto stdout (Crafter.Build-Script.cpp:24-29).Anything that pipes crafter-build's output therefore gets progress mixed into it. For example,
crafter-build run <script> --json | jqfails, because every load prints[n/m] Updating …for the unpinned dependencies it pulls (Crafter.Build-External.cpp:427-432) before the script even starts. Agents drive crafter-build through a Bash tool without a terminal, so they see the same lines in the output of every command.Proposal
This is the version agreed with Jorijn.
[n/m] labellines without one;-vcommand echo;ScriptContext::Run's$ cmdecho, which is crafter-build's own chatter (likeset -x), not the script's output.isatty(STDERR_FILENO), and the width from stderr too. Thencrafter-build run x --json | jqstill draws the status line on the terminal while jq gets clean JSON.--version,--help, the--listlistings, test results and lint findings.runkeeps pulling unpinned dependencies, like every other verb. An explicit--offlinefor all verbs can come later if someone needs it.crafter-build > build.lognow needs2>&1to keep the progress.claude/flatpak-debug-toolsedits both.Done when
crafter-build run <script> | catshows only the script's output, and the progress goes to stderr.2>&1.Context
This came up while designing Crafter.Debug, which first planned to run its client through
crafter-build run debug. Crafter.Debug now uses a launcher (build/crafter-debug) instead, so nothing waits on this; it is a general fix. The per-call load cost that ruled out the script route is #47.