Skip to content

CLI: a closed stdout ends vectorcraft-cli quietly - #181

Merged
echelon merged 1 commit into
storytold:mainfrom
japbcoelho:fix/cli-closed-stdout
Oct 6, 2026
Merged

echelon merged 1 commit into
storytold:mainfrom
japbcoelho:fix/cli-closed-stdout

Conversation

@japbcoelho

Copy link
Copy Markdown
Contributor

What and why

vectorcraft-cli commands | head -1 panicked and exited with status 101:

thread 'main' panicked at /rustc/b940084d7eb6a299eb4bfeb8e34901bc051e7ac4/library/std/src/io/stdio.rs:1168:9:
failed printing to stdout: Broken pipe (os error 32)

println! and print! panic when stdout is closed. The CLI now prints through outln! and out!: a broken pipe ends the program with status 0, since the reader already has what it wanted, and any other write error goes to stderr with status 1. storytold/designcraft#43 makes the same change in DesignCraft.

How it was tested

closed_stdout_ends_quietly in apps/vectorcraft-cli/tests/cli.rs reads the first 16 bytes of commands, about 270 KB in all, and closes the pipe. It fails on main 2c02502 and passes with the fix.

Checklist

  • cargo xtask ci passes (fmt, clippy, tests, assets, brands, layers, wasm).
  • No panics in shipped code: no unwrap(), expect(), panic!, unreachable!, todo! or
    unimplemented! outside tests, and no unchecked indexing on data from files, parameters or
    messages. Errors are returned as Result and shown to the user
    (why and how).
  • Clean-room: nothing copied from Adobe products or GPL/AGPL code (AGENTS.md).
  • Every new asset has a row in ASSETS.md (no new assets).

🤖 Generated with Claude Code

`vectorcraft-cli commands | head -1` panicked and exited with status 101:

  thread 'main' panicked at library/std/src/io/stdio.rs:1168:9:
  failed printing to stdout: Broken pipe (os error 32)

println! and print! panic when stdout is closed. Output now goes through
outln! and out!, which end the program with status 0 on a broken pipe (the
reader has what it wanted) and report any other write error on stderr with
status 1.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon
echelon merged commit ebc6d1a into storytold:main Oct 6, 2026
@echelon

echelon commented Oct 6, 2026

Copy link
Copy Markdown
Member

Thanks @japbcoelho, merged! vectorcraft-cli commands | head ending quietly instead of panicking on a broken pipe is the right Unix behaviour, and routing every print through one place that tells a closed pipe apart from a real write error is tidy. Full CI passes with your test.

If you're not already there, come say hi in our Discord, we'd love to have you: https://discord.gg/artcraft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants