[PR #1970] [MERGED] fix: Make --quiet flag work again #2770

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

📋 Pull Request Information

Original PR: https://github.com/CCExtractor/ccextractor/pull/1970
Author: @cfsmp3
Created: 1/2/2026
Status: Merged
Merged: 1/2/2026
Merged by: @cfsmp3

Base: masterHead: fix/quiet-flag-broken


📝 Commits (1)

  • d31ea87 fix: Make --quiet flag work again

📊 Changes

4 files changed (+35 additions, -3 deletions)

View changed files

📝 src/ccextractor.c (+3 -0)
📝 src/lib_ccx/lib_ccx.h (+1 -0)
📝 src/rust/lib_ccxr/src/util/log.rs (+5 -0)
📝 src/rust/src/libccxr_exports/mod.rs (+26 -3)

📄 Description

Summary

The --quiet flag was broken in version 0.96, causing output to still be printed even when the flag was specified.

Root causes:

  1. Inverted mapping in Rust FFI: The C→Rust constant mapping was wrong. CCX_MESSAGES_QUIET=0, CCX_MESSAGES_STDOUT=1, CCX_MESSAGES_STDERR=2 but the Rust code mapped 0→Stdout, 1→Stderr, 2→Quiet.

  2. Logger initialization timing: The Rust logger was initialized BEFORE command-line arguments were parsed, so --quiet had no effect on the logger's target.

Changes:

  • Fix the OutputTarget mapping in ccxr_init_basic_logger()
  • Add set_target() method to CCExtractorLogger to allow updating after initialization
  • Add ccxr_update_logger_target() FFI function to update logger after arg parsing
  • Call ccxr_update_logger_target() after ccxr_parse_parameters() in main

Test plan

  • Verified --quiet now produces no output
  • Verified normal mode still produces expected output
  • Verified output files are still generated correctly with --quiet
  • All 265 Rust unit tests pass
  • CI passes on Linux and Windows

Fixes #1956

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/CCExtractor/ccextractor/pull/1970 **Author:** [@cfsmp3](https://github.com/cfsmp3) **Created:** 1/2/2026 **Status:** ✅ Merged **Merged:** 1/2/2026 **Merged by:** [@cfsmp3](https://github.com/cfsmp3) **Base:** `master` ← **Head:** `fix/quiet-flag-broken` --- ### 📝 Commits (1) - [`d31ea87`](https://github.com/CCExtractor/ccextractor/commit/d31ea87c03c5107c336d33377a31058e92763a80) fix: Make --quiet flag work again ### 📊 Changes **4 files changed** (+35 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `src/ccextractor.c` (+3 -0) 📝 `src/lib_ccx/lib_ccx.h` (+1 -0) 📝 `src/rust/lib_ccxr/src/util/log.rs` (+5 -0) 📝 `src/rust/src/libccxr_exports/mod.rs` (+26 -3) </details> ### 📄 Description ## Summary The `--quiet` flag was broken in version 0.96, causing output to still be printed even when the flag was specified. **Root causes:** 1. **Inverted mapping in Rust FFI:** The C→Rust constant mapping was wrong. `CCX_MESSAGES_QUIET=0, CCX_MESSAGES_STDOUT=1, CCX_MESSAGES_STDERR=2` but the Rust code mapped `0→Stdout, 1→Stderr, 2→Quiet`. 2. **Logger initialization timing:** The Rust logger was initialized BEFORE command-line arguments were parsed, so `--quiet` had no effect on the logger's target. **Changes:** - Fix the `OutputTarget` mapping in `ccxr_init_basic_logger()` - Add `set_target()` method to `CCExtractorLogger` to allow updating after initialization - Add `ccxr_update_logger_target()` FFI function to update logger after arg parsing - Call `ccxr_update_logger_target()` after `ccxr_parse_parameters()` in main ## Test plan - [x] Verified `--quiet` now produces no output - [x] Verified normal mode still produces expected output - [x] Verified output files are still generated correctly with `--quiet` - [x] All 265 Rust unit tests pass - [ ] CI passes on Linux and Windows Fixes #1956 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-29 17:23:49 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ccextractor#2770