Problem
The interactive tests for cargo changeset add are currently skipped on Windows CI due to a fundamental incompatibility between the console crate's TTY detection and GitHub Actions' ConPTY environment.
Root Cause
The console crate (used by dialoguer) uses GetConsoleMode() on Windows to detect if stdin/stdout is a terminal. In GitHub Actions CI, even when using expectrl's ConPTY-based pseudo-terminal, GetConsoleMode() fails and is_term() returns false.
This causes dialoguer's MultiSelect::interact_opt() to fail with:
error: IO error
caused by: not a terminal
Current Workaround
Interactive tests are conditionally compiled only on non-Windows platforms:
#[cfg(not(windows))]
mod interactive { ... }
Potential Solutions to Investigate
-
Custom Term implementation: Create a wrapper around console::Term that overrides is_term() to always return true when a specific env var is set
-
Alternative PTY library: Research if other Windows PTY libraries work better with GetConsoleMode()
-
Dialoguer fork/PR: Contribute an option to dialoguer to skip the is_term() check when a force flag is provided
-
Mock-based testing: Refactor crate selection to use a trait that can be mocked in tests, bypassing dialoguer entirely
References
Problem
The interactive tests for
cargo changeset addare currently skipped on Windows CI due to a fundamental incompatibility between theconsolecrate's TTY detection and GitHub Actions' ConPTY environment.Root Cause
The
consolecrate (used bydialoguer) usesGetConsoleMode()on Windows to detect if stdin/stdout is a terminal. In GitHub Actions CI, even when usingexpectrl's ConPTY-based pseudo-terminal,GetConsoleMode()fails andis_term()returnsfalse.This causes
dialoguer'sMultiSelect::interact_opt()to fail with:Current Workaround
Interactive tests are conditionally compiled only on non-Windows platforms:
Potential Solutions to Investigate
Custom
Termimplementation: Create a wrapper aroundconsole::Termthat overridesis_term()to always returntruewhen a specific env var is setAlternative PTY library: Research if other Windows PTY libraries work better with
GetConsoleMode()Dialoguer fork/PR: Contribute an option to dialoguer to skip the
is_term()check when a force flag is providedMock-based testing: Refactor crate selection to use a trait that can be mocked in tests, bypassing dialoguer entirely
References
expectrlusesconptycrate for Windows PTYconsolecrate TTY detection: https://github.com/console-rs/consoledialoguerchecksterm.is_term()before interaction