message: Check for .eof() right after attempting to read a character.
diff: @@ -307,16 +307,16 @@ LineNumberSet FilePatch::AddedLines() const {
  }
  static char PromptHunkAction(std::istream& ins, std::ostream& outs) {
  + // Suppress prompt in noninteractive mode.
  + if (isatty(0)) outs << "Apply this hunk? [y,n,a,d,q,?] ";
  + char c;
  + ins >> c; // user will need to hit <enter> after the character
  if (ins.eof()) {
  outs << "Reached end of user input, abandoning changes to this file and "
  "all remaining files."
  << std::endl;
  return 'q';
  }
  - // Suppress prompt in noninteractive mode.
  - if (isatty(0)) outs << "Apply this hunk? [y,n,a,d,q,?] ";
  - char c;
  - ins >> c; // user will need to hit <enter> after the character
  return c;
  }
  