Skip to content

Fix double quiet warnings with redirected output - #1979

Open
Doyoubelieveinfate wants to merge 1 commit into
httpie:masterfrom
Doyoubelieveinfate:fix/quiet-warnings-redirected-output
Open

Doyoubelieveinfate wants to merge 1 commit into
httpie:masterfrom
Doyoubelieveinfate:fix/quiet-warnings-redirected-output

Conversation

@Doyoubelieveinfate

@Doyoubelieveinfate Doyoubelieveinfate commented Oct 20, 2026 •

Copy link
Copy Markdown

Prepared with Codex at @Doyoubelieveinfate's request.

Fixes #1978.

With stdout redirected, http -qq --check-status URL > output still prints HTTP status warnings because log_error() bypasses the quiet threshold when stdout is not a TTY. Apply the threshold regardless of stdout redirection. A single -q still displays warnings; errors and exit codes are preserved.

Update the redirected-output regression test for both -qq and --quiet --quiet, assert the HTTP error exit code, and check that errors remain visible with either terminal or redirected output.

Validation on Python 3.13.5:

  • The two warning-suppression cases fail before the fix and pass afterward.
  • Output, error, and session suites: 196 passed, 3 expected failures.
  • Real CLI subprocesses against a local HTTP 500 server: -qq suppresses warnings while keeping exit code 5; -q retains warnings. An invalid URL still prints an error and exits 1.
  • make codestyle VENV_ROOT=.venv and git diff --check pass.

CI note: the Ubuntu/Python 3.7 jobs fail in actions/setup-python, before running tests, because Python 3.7 is unavailable for Ubuntu 24.04 (job log). The code-style and documentation checks pass.

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: log_error ignores --quiet flag when stdout is redirected

1 participant