Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion httpie/output/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def write_message(
'flush': env.stdout_isatty or processing_options.stream
}
try:
if env.is_windows and 'colors' in processing_options.get_prettify(env):
if env.is_windows and env.stdout_isatty and 'colors' in processing_options.get_prettify(env):
write_stream_with_colors_win(**write_stream_kwargs)
else:
write_stream(**write_stream_kwargs)
Comment on lines +49 to 52
Copy link

Copilot AI Mar 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a regression test for this Windows-specific branch selection: when env.is_windows is true, colors are requested (e.g. --pretty=all), and env.stdout_isatty is false (piped/redirected), we should use the raw write_stream() path (and not write_stream_with_colors_win()) so ANSI escape codes are preserved. Without a test, this behavior is easy to accidentally regress and reintroduce the color-stripping issue reported in #799.

Copilot uses AI. Check for mistakes.
Expand Down
Loading