use stdin/stdout instead of raw_input when not running on a tty