Skip to content

fix: flush buffered stdout once at end of exec to show canister call output#529

Merged
raymondk merged 3 commits intomainfrom
lwshang/flush_json
Apr 23, 2026
Merged

fix: flush buffered stdout once at end of exec to show canister call output#529
raymondk merged 3 commits intomainfrom
lwshang/flush_json

Conversation

@lwshang
Copy link
Copy Markdown
Contributor

@lwshang lwshang commented Apr 23, 2026

Summary

  • icp canister call --json was producing blank output because Term::buffered_stdout() was never flushed — serde_json::to_writer takes a reference and the buffer held the bytes unsent.
  • Consolidated the scattered term.flush() calls (one per output branch) into a single flush at the end of exec, after all writes and after propagating any closure error.

Test plan

  • New integration test canister_call_json_output deploys a canister, calls greet with --json, and asserts stdout is non-empty valid JSON with the expected response_bytes and response_candid fields — directly covering the regression.
  • Existing canister_call_output_modes and other call tests continue to pass.

🤖 Generated with Claude Code

lwshang and others added 3 commits April 23, 2026 18:12
…output

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@lwshang lwshang marked this pull request as ready for review April 23, 2026 22:30
@lwshang lwshang requested a review from a team as a code owner April 23, 2026 22:30
@raymondk raymondk merged commit 36789da into main Apr 23, 2026
90 checks passed
@raymondk raymondk deleted the lwshang/flush_json branch April 23, 2026 22:53
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