Properly handle EOF on input.