tty
Detect whether stdin is connected to a terminal and return the terminal device path, enabling distinction between interactive and piped execution contexts.
Instructions
Check if stdin is connected to a terminal and return the terminal device path. Read-only, no side effects. Returns JSON with the TTY path and connection status; exits non-zero if not a TTY. Use to detect interactive vs. piped execution contexts. Not for terminal configuration — use 'stty' for terminal settings. See also 'stty'.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exit_code | No | Return exit code 1 when stdin is not a TTY. | |
| raw | No | Write tty path or 'not a tty' without a JSON envelope. |