<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -94,6 +94,8 @@ module Cheat
     run_pager
     puts sheet.first + ':'
     puts '  ' + sheet.last.gsub(&quot;\r&quot;,'').gsub(&quot;\n&quot;, &quot;\n  &quot;).wrap
+  rescue Errno::EPIPE
+    # do nothing
   rescue
     puts &quot;That didn't work.  Maybe try `$ cheat cheat' for help?&quot; # Fix Emacs ruby-mode highlighting bug: `&quot;
   end
@@ -174,6 +176,8 @@ module Cheat
     unless Kernel.fork # Child process
       STDOUT.reopen(write)
       STDERR.reopen(write)
+      read.close
+      write.close
       return
     end
 </diff>
      <filename>lib/cheat.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>06d0679bc505777a6b981f529ce035d28ae7d5e3</id>
    </parent>
  </parents>
  <author>
    <name>Kevin Ballard</name>
    <email>kevin@sb.org</email>
  </author>
  <url>http://github.com/nex3/cheat/commit/b35f2288ee74bf15286faafd76297a94cebafeb3</url>
  <id>b35f2288ee74bf15286faafd76297a94cebafeb3</id>
  <committed-date>2008-03-18T21:42:44-07:00</committed-date>
  <authored-date>2008-03-18T21:42:44-07:00</authored-date>
  <message>Fix cheat hanging if the pager is quit before consuming all input

An easy test of this is with `cheat iana_port_list`.
If less is quit immediately, cheat will hang forever due to the improperly closed pipe.
But when the pipe is closed properly, it will get an Errno::EPIPE instead, so we have
to handle both conditions.</message>
  <tree>86dae84630b9f560bf9125365e739a16f08d9515</tree>
  <committer>
    <name>Kevin Ballard</name>
    <email>kevin@sb.org</email>
  </committer>
</commit>
