Skip to content

fix(cli): write JSON output to stdout instead of stderr#13

Merged
echobt merged 1 commit intomasterfrom
fix/bounty-issue-1495
Jan 26, 2026
Merged

fix(cli): write JSON output to stdout instead of stderr#13
echobt merged 1 commit intomasterfrom
fix/bounty-issue-1495

Conversation

@echobt
Copy link
Contributor

@echobt echobt commented Jan 26, 2026

Summary

When using --json or --jsonl output format with cortex run, JSON event objects were incorrectly written to stderr instead of stdout. This caused malformed output when piping to tools like jq.

Changes

  • Changed eprintln! to println! for JSON event output in the main event loop
  • Changed eprintln! to println! for error JSON output when in JSON mode

Related

Fixes PlatformNetwork/bounty-challenge#1495

Fixes bounty issue #1495

When using --json or --jsonl output format, JSON event objects were being
written to stderr (eprintln!) instead of stdout (println!). This caused
malformed output when piping to tools like jq, as the JSON events would
appear in the terminal while the final result was piped to the destination.

Changed eprintln! to println! for JSON event output and error JSON output
to ensure all JSON data goes to stdout for proper piping support.
@echobt echobt force-pushed the fix/bounty-issue-1495 branch from 17bdd88 to fed987e Compare January 26, 2026 16:50
@echobt echobt merged commit 360d2db into master Jan 26, 2026
3 of 12 checks passed
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.

[BUG] cortex run Misdetects JSON Output Mode When Piped

2 participants