def enable_paging
      return unless $stdout.tty?
      return unless Process.respond_to? :fork
      read, write = IO.pipe

      # Kernel.fork is not supported on all platforms and configurations.
      # As of Ruby 1.9, `Process.respond_to? :fork` should return false on
      # configurations that don't support it, but versions before 1.9 don't
      # seem to do this reliably and instead raise a NotImplementedError
      # (which is rescued below).

      if Kernel.fork
        $stdin.reopen read
        write.close
        read.close
        Kernel.select [$stdin]
        ENV['LESS'] = 'FSRX' unless ENV.key? 'LESS'
        pager = ENV['PAGER'] || 'less'
        exec pager rescue exec '/bin/sh', '-c', pager
      else
        # subprocess
        $stdout.reopen write
        $stderr.reopen write if $stderr.tty?
        write.close
        read.close
      end
    rescue NotImplementedError
    ensure
      write.close if write && !write.closed?
      read.close if read && !read.closed?
    end
def enable_paging
      return unless $stdout.tty?
      return unless Process.respond_to? :fork
      read, write = IO.pipe

      # Kernel.fork is not supported on all platforms and configurations.
      # As of Ruby 1.9, `Process.respond_to? :fork` should return false on
      # configurations that don't support it, but versions before 1.9 don't
      # seem to do this reliably and instead raise a NotImplementedError
      # (which is rescued below).

      if Kernel.fork
        $stdin.reopen read
        write.close
        read.close
        Kernel.select [$stdin]
        ENV['LESS'] = 'FSRX' unless ENV.key? 'LESS'
        pager = ENV['PAGER'] || 'less'
        exec pager rescue exec '/bin/sh', '-c', pager
      else
        # subprocess
        $stdout.reopen write
        $stderr.reopen write if $stderr.tty?
        write.close
        read.close
      end
    rescue NotImplementedError
    ensure
      write.close if write && !write.closed?
      read.close if read && !read.closed?
    end
Enable paging of output after called.