Skip to main content

open_controlling_tty

Function open_controlling_tty 

Source
pub fn open_controlling_tty() -> Result<TtyHandles, Error>
Expand description

Open the controlling terminal for read+write. Unix uses /dev/tty; Windows uses CONIN$/CONOUT$ via CreateFileW.

Honors the documented test-only fault-injection env var RUSTY_VIPE_TEST_FAIL_TTY=1 which forces NoControllingTty even when a real terminal is available. Used by tests/no_tty.rs integration tests because reliably stripping the controlling-TTY from a child process is platform-specific (Unix needs setsid + double-fork; Windows needs CREATE_NO_WINDOW + detached process group). The env-var bypass keeps the test surface portable without sacrificing FR-015 coverage.