Skip to content

Preview Ruby 4.1 is a preview. It can change before the final release. Switch to Ruby 4.0 →

instance method

IO#isatty

() -> bool
isatty(*args)

Alias of #tty?

Returns true if the stream is associated with a terminal device (tty), false otherwise.

If one or more types are given, returns true if the stream is associated with any of the specified tty types.

  • nil : Returns the result of the default tty check, as if no type were given. It can be combined with other types.

  • :any : Returns true for any known kind of tty, including the default tty.

  • :cygwin : Returns true for cygwin tty, on Windows.

  • :msys : Returns true for msys2 tty, on Windows.

See also #tty? #ioflush #lineno #ioctl also in 4.0 · 3.4 · 3.3 · 3.2 · 3.1 · 3.0