feat(cli): add JSON output to exec - #1395
Draft
Whxuan0701 wants to merge 2 commits into
Draft
Conversation
Expose captured stdout, stderr, and guest exit status as structured JSON for reliable host-side agent orchestration. Preserve arbitrary output bytes with explicit UTF-8 or Base64 encoding metadata.
|
Reject missing commands in JSON mode and explicitly flush structured output before propagating the guest exit status.
|
Reviews (2): Last reviewed commit: "fix(cli): preserve exec JSON output cont..." | Re-trigger Greptile |
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.
TL;DR
Add structured JSON output to
msb execso agents and host-side orchestrators can consume exit status and captured output without parsing terminal text.Description
msb exec NAME --format json -- COMMANDfor non-interactive execution.exit_code,success,stdout, andstderrin one JSON object.msbprocess exit code.--ttyor--stream, and document the machine-readable contract.Test Plan
cargo fmt --all -- --checkcargo test -p microsandbox-cli --libinrust:1.97-bookwormwithlibcap-ng-dev(314 passed)cargo clippy -p microsandbox-cli --lib -- -D warningsin the same Linux containerReal microVM execution was not run because the available host is Intel macOS, while this project's local libkrun runtime does not support that host configuration.