[PR #1974] fix(rust): Flush stdout after print to fix stream mode display #2776

Open
opened 2026-01-29 17:23:50 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/CCExtractor/ccextractor/pull/1974

State: closed
Merged: Yes


Summary

  • Fixes empty [Stream mode: ] display when using --input <format> options
  • Adds explicit stdout/stderr flush after print operations in Rust logger

Problem

When using --input scc (or other formats), the startup output showed:

[Stream mode: ]

Instead of:

[Stream mode: SCC]

Root Cause

The Rust logger's print() function uses print!() which doesn't automatically flush stdout. When mixing C and Rust code that both write to stdout, the Rust output was getting buffered and not appearing before the C code continued writing.

Solution

Added explicit std::io::stdout().flush() after each print!() call to ensure output appears immediately and interleaves correctly with C code.

Test plan

  • --input scc shows [Stream mode: SCC]
  • --input mkv shows [Stream mode: MKV]
  • --input ts shows [Stream mode: Transport]
  • Autodetect shows [Stream mode: Autodetect]
  • All 265 Rust tests pass

🤖 Generated with Claude Code

**Original Pull Request:** https://github.com/CCExtractor/ccextractor/pull/1974 **State:** closed **Merged:** Yes --- ## Summary - Fixes empty `[Stream mode: ]` display when using `--input <format>` options - Adds explicit stdout/stderr flush after print operations in Rust logger ## Problem When using `--input scc` (or other formats), the startup output showed: ``` [Stream mode: ] ``` Instead of: ``` [Stream mode: SCC] ``` ## Root Cause The Rust logger's `print()` function uses `print!()` which doesn't automatically flush stdout. When mixing C and Rust code that both write to stdout, the Rust output was getting buffered and not appearing before the C code continued writing. ## Solution Added explicit `std::io::stdout().flush()` after each `print!()` call to ensure output appears immediately and interleaves correctly with C code. ## Test plan - [x] `--input scc` shows `[Stream mode: SCC]` - [x] `--input mkv` shows `[Stream mode: MKV]` - [x] `--input ts` shows `[Stream mode: Transport]` - [x] Autodetect shows `[Stream mode: Autodetect]` - [x] All 265 Rust tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code)
claunia added the pull-request label 2026-01-29 17:23:50 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2776