If NGSession.exit() is called then client is sent with exit code. That causes client to terminate a socket but NGCommunicator uses threads to listen to stdin and heartbeats. If socket is terminated, but nail is not finished yet, this causes that reading thread to unblock, throw and print a naughty message to a log.
The change will process closure gracefully. It stops reading first, sends exit code, then closes the socket. Nail might still continue but it can't read/write from the the socket. Basically, this gives the same as System.exit() but allows the nail code to continue executing.
If NGSession.exit() is called then client is sent with exit code. That causes client to terminate a socket but NGCommunicator uses threads to listen to stdin and heartbeats. If socket is terminated, but nail is not finished yet, this causes that reading thread to unblock, throw and print a naughty message to a log. The change will process closure gracefully. It stops reading first, sends exit code, then closes the socket. Nail might still continue but it can't read/write from the the socket. Basically, this gives the same as System.exit() but allows the nail code to continue executing.