Check isatty before calling readline

This fixes the problem where commands hang on the CLA until you enter a newline.