Method: IO#tty?
- Defined in:
- io.c
#isatty ⇒ Boolean
Returns true if the stream is associated with a terminal device (tty), false otherwise:
f = File.new('t.txt').isatty #=> false
f.close
f = File.new('/dev/tty').isatty #=> true
f.close
5293 5294 5295 5296 5297 5298 5299 5300 |
# File 'io.c', line 5293 static VALUE rb_io_isatty(VALUE io) { rb_io_t *fptr; GetOpenFile(io, fptr); return RBOOL(isatty(fptr->fd) != 0); } |