Fix yes-or-no-p when there is no tty

Signed-off-by: Bao Haojun <baohaojun@gmail.com>