Method IsAttachedToTerminal
IsAttachedToTerminal(out bool, out bool)
Determines whether the process has a controlling terminal usable for TUI rendering and input. Returns true when either:
- stdin/stdout are connected to a console device, or
-
stdin/stdout are redirected (e.g. via a shell pipeline such as
result=$(myapp)ormyapp | jq) but a controlling terminal is available via/dev/ttyon Unix orCONIN$/CONOUT$on Windows.
Set the environment variable DisableRealDriverIO=1 to skip real terminal detection and
force this method to return false, which is required for running in test harnesses that do not
have a real terminal attached.
public static bool IsAttachedToTerminal(out bool inputAttached, out bool outputAttached)
Parameters
inputAttachedboolWhen this method returns, true if a terminal device is available for input (either stdin or the controlling terminal); otherwise false.
outputAttachedboolWhen this method returns, true if a terminal device is available for output (either stdout or the controlling terminal); otherwise false.