Try checking for a tty.