finsh_getchar invokes getchar, who's return type is int, and return value may < 0, which means error occurred or EOF. finsh should handle that situation properly, and inform user about the error.