Repository navigation
fix(cli): keep db export stdout clean by routing the banner to stderr - #253
Merged
Brooooooklyn merged 1 commit intoJul 4, 2026
Conversation
Brooooooklyn
approved these changes
Jul 4, 2026
Brooooooklyn
deleted the
07-04-fix_cli_keep_db_export_stdout_clean_by_routing_the_banner_to_stderr
branch
July 4, 2026 12:31
cpojer
pushed a commit
that referenced
this pull request
Sep 11, 2026
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
runDbCommandnow detects theexportaction without--outputand sends the intro banner (and its leading blank line) to stderr for that mode.runExportsends its three error messages to stderr as well. The SQL dump still goes to stdout viaprocess.stdout.write. Every other db subcommand is unchanged.Why
void db exportwithout--outputstreams raw SQL to stdout so it can be piped or redirected, for examplevoid db export > dump.sqlorvoid db export | sqlite3 new.db. But the command printed the clack intro banner first, and clack writes to stdout by default, so the dump began with a blank line and avoid dbbanner before the firstCREATE TABLE. Feeding that file into sqlite3 fails with a parse error on the banner line and the restore never runs. Errors raised during a piped export were also written into the dump and hidden from the user, so routing them to stderr both keeps the dump clean and makes the error visible on the terminal.Safety
The change is scoped to the export to stdout path. Other db subcommands keep their banner and status on stdout exactly as before, and
void db export --output file.sqlis unaffected because that path does not stream to stdout. The banner still appears on the terminal in every case, since stderr is not redirected by a stdout pipe.Verification
A new regression test at
packages/void/test/unit/db-export-stdout.test.tsdrivesrunDbCommandwith the real clack library and a mocked SQLite layer, then asserts that stdout is byte for byte the SQL dump and that the banner lands on stderr. It fails on the old code, where stdout starts with the banner, and passes on the fix. Thedb-migrate,db-seed, anddb-commandssuites that assert exact clack arguments stay green (33 tests total), and the void package typechecks with tsgo and passes oxlint.