Skip to main content

detect_interactive

Function detect_interactive 

Source
pub fn detect_interactive() -> bool
Expand description

Returns true when the process appears to be running interactively: stdin and stderr are both TTYs.

Checking stdin ensures that piped input (echo "" | gddy ...) is detected as non-interactive. Checking stderr ensures prompts can be displayed (since inquire renders to stderr). Stdout is intentionally not checked — a user piping output (gddy ... | jq) still has an interactive terminal for prompts.

Used as the default for GlobalFlags::interactive when the user does not pass --interactive or --non-interactive explicitly.