⚡ fonksiyon

is_tty

fonksiyon is_tty

Check if a file handle is connected to a terminal (TTY).

Bir dosya handle'ının terminale (TTY) bağlı olup olmadığını kontrol et.

Parameters / Parametreler

  • file: The file handle to check / Kontrol edilecek dosya handle'ı

Returns / Dönüş Değeri

Returns true if connected to terminal, false if piped/redirected. Terminale bağlıysa true, pipe/yönlendirilmişse false döner.

Example / Örnek

eğer io.is_tty(io.stdout()) yap
// Use colors and interactive features
yazdır("\x1b[32mGreen text\x1b[0m")
yoksa yap
// Plain output for pipes
yazdır("Plain text")
son

Performance / Performans

O(1) - Simple system call. O(1) - Basit sistem çağrısı.

📍 Kaynak Kodu

Satır 0