tty check when writing to stdout