Skip to content

Conversation

@ccaum
Copy link

@ccaum ccaum commented Feb 7, 2026

Problem

The watch command produces no output even though message detection is working correctly.

Root Cause

Swift's print() doesn't flush stdout immediately, causing output to be buffered and never displayed when running in watch mode.

Solution

Added fflush(stdout) call after printing JSON lines.

Testing

Before: imsg watch --chat-id 1 --json produces zero output
After: Messages appear immediately as they arrive

Impact

  • ✅ Fixes CLI watch mode
  • ✅ Fixes RPC watch notifications (used by OpenClaw and other integrations)
  • ✅ No breaking changes
  • ✅ No performance impact

The watch command was not producing any output because stdout was not being flushed after printing JSON lines. This caused the watch functionality to appear broken even though message detection was working correctly.

Added fflush(stdout) call after Swift.print() to ensure immediate output delivery, fixing both CLI watch mode and RPC watch notifications.

Fixes: Messages detected but not displayed
Testing: Verified with 'imsg watch --chat-id 1 --json' - messages now appear immediately
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