grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrei Borzenkov <arvidjaar@gmail.com>
To: Valentin Dornauer <valentin@unimplemented.org>
Cc: grub-devel@gnu.org, ehrhardt@genua.de
Subject: Re: Support abort of 'cat' even if in paging mode
Date: Sun, 18 Jan 2015 18:33:52 +0300	[thread overview]
Message-ID: <20150118183352.4801e706@opensuse.site> (raw)
In-Reply-To: <20150114104957.GA14476@unimplemented.org>

В Wed, 14 Jan 2015 11:49:57 +0100
Valentin Dornauer <valentin@unimplemented.org> пишет:

> Hello,
> we needed a way for GRUB to show a rather large text file in pager
> mode (set pager=1) while still allowing the user to abort without
> scrolling all the way to the bottom of the file.
> 
> From the original commit message:
>  [...] The reason is that "cat" scans for key strokes but does not
>  block waiting for them. This results in a race between the pager
>  that eats all the keystrokes and "cat" that scans for them in
>  non-blocking mode.
> 
>  To fix this, we let the pager report if a keypress was ESC, 'q'
>  or 'Q'.  The caller can check for this and stop the printing of
>  data. The behaviour of the pager itself is not affected by this.
> 
> Please note that this is a rather quick fix and there might be a
> better solution (possibly entirely inside the term layer?). If anyone
> has a better solution, please let me know. Otherwise I could submit
> a proper patch using this fix.
> 

It is not limited to cat; just try to run lsefi on any real system (or
even VM). Even simple "ls -l" could be quite time consuming. For this
reasons I would suggest having common grub_output_interrupted()
function that could be used in all commands doing long term output. The
we could start adding it to each command.

The idea is to minimize impact on existing commands and to abstract
away how we actually signal termination of output.

> Original patch by Christian Ehrhardt <ehrhardt@genua.de>.
> 
> Thanks
> Valentin



      reply	other threads:[~2015-01-18 15:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-14 10:49 Support abort of 'cat' even if in paging mode Valentin Dornauer
2015-01-18 15:33 ` Andrei Borzenkov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150118183352.4801e706@opensuse.site \
    --to=arvidjaar@gmail.com \
    --cc=ehrhardt@genua.de \
    --cc=grub-devel@gnu.org \
    --cc=valentin@unimplemented.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).