Module: RSpec::CapturingFormatter::WindowsTerminal
- Defined in:
- lib/rspec/capturing_formatter/windows_terminal.rb
Overview
Determines ANSI support and enables Virtual Terminal processing for Windows Terminal output.
Defined Under Namespace
Classes: NativeApi
Constant Summary collapse
- ENABLE_VIRTUAL_TERMINAL_PROCESSING =
0x0004- STD_OUTPUT_HANDLE =
-11
- STD_ERROR_HANDLE =
-12
Class Method Summary collapse
-
.ansi_supported?(output, on_windows: Gem.win_platform?, env: ENV, api: nil) ⇒ Boolean
Redirected output remains ANSI-capable; interactive output requires Windows Terminal and VT support.
Class Method Details
.ansi_supported?(output, on_windows: Gem.win_platform?, env: ENV, api: nil) ⇒ Boolean
Redirected output remains ANSI-capable; interactive output requires Windows Terminal and VT support. Fiddle failures fall back to plain text, while unrelated errors propagate.
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rspec/capturing_formatter/windows_terminal.rb', line 16 def ansi_supported?(output, on_windows: Gem.win_platform?, env: ENV, api: nil) return true unless on_windows begin return true unless tty?(output) return false unless windows_terminal?(env) (api || NativeApi.new).enable_virtual_terminal_processing(output) rescue Fiddle::Error false end end |