Skip to content

mkrootfs: emit complete inspect output#920

Closed
brandonpayton wants to merge 1 commit into
mainfrom
fix/mkrootfs-inspect-stdout-drain
Closed

mkrootfs: emit complete inspect output#920
brandonpayton wants to merge 1 commit into
mainfrom
fix/mkrootfs-inspect-stdout-drain

Conversation

@brandonpayton

Copy link
Copy Markdown
Member

Problem

mkrootfs inspect --format json called process.exit() as soon as the command promise resolved. Node could terminate before buffered stdout drained, so a 1,501-entry image produced only 65,536 of 198,111 bytes and invalid JSON.

Fix

  • Set process.exitCode after command completion so normal event-loop shutdown drains stdout.
  • Treat stdout EPIPE as a normal early-closing consumer, while leaving other stream errors visible.
  • Cover both complete output above 64 KiB and an early-closing pipe through the real CLI shim.

Evidence

All commands ran through scripts/dev-shell.sh with Node 24.15.0.

Probe Before After
Large JSON stdout 65,536 bytes, invalid JSON 198,111 bytes, 1,501 parsed entries
head -c 1 consumer exit 0, empty stderr exit 0, empty stderr
Injected stdout EIO error visible exit 1, error visible
  • Focused regressions: 2/2 passed.
  • Full tools/mkrootfs suite: 135/135 passed.
  • ES2024 TypeScript no-emit check: passed.
  • Independent devil review: accepted the exact pushed commit and tree with no blocker, high, or medium findings.

Scope

This changes only CLI process shutdown and its tests. It does not change the Kandelo runtime, Node/browser host behavior, VFS format, ABI, packages, or release artifacts. Broad runtime and browser suites were not run because those paths are unaffected.

Allow Node to flush asynchronous stdout writes before normal shutdown so large inspect output is not truncated. Treat stdout EPIPE as normal pipeline termination when a consumer closes early, while preserving other stream failures.
@github-actions

Copy link
Copy Markdown

Phase B-1 matrix build status — pr-920-staging

ABI v18. 5 built, 0 failed, 5 total.

Package Arch Status Sha
rootfs wasm32 built d27191fb
shell wasm32 built 8c8724d2
lamp wasm32 built af4ac801
node-vfs wasm32 built 71c76ec3
wordpress wasm32 built 08d29526

Auto-generated; replaced on each push. Raw data in the publish-status workflow artifact.

@brandonpayton

Copy link
Copy Markdown
Member Author

Replacement batch #921 preserves this PR exact patch as commit 2ffd72348 on merged ABI39 with an identical stable patch ID. Keep this PR open until the combined batch CI and maintainer review complete, then close it as superseded.

@brandonpayton

Copy link
Copy Markdown
Member Author

Superseded by merged #921. This PR's head is patch-equivalent to main (git cherry reports '-'); #921 carries the complete mkrootfs inspect output draining as commit 2ffd723. No unique behavior or test remains unmerged.

@brandonpayton
brandonpayton deleted the fix/mkrootfs-inspect-stdout-drain branch July 13, 2026 22:58
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.

1 participant