backporting 17d5600bfef6ac83bc57596b71860e2ed3a6a36e:
"Shell: Print a warning when exiting with unterminated input"