Use nonblocking-aware readline to avoid data loss in certain cases.