msh: also handle EOF/read errors correctly