Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

IO#ttyname

io.ttyname → string or nil

Returns name of associated terminal (tty) if io is not a tty. Returns nil otherwise.

See also #tty? #ungetbyte #to_path #ungetc also in 4.1 · 4.0