[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support abort of 'cat' even if in paging mode

From: Andrei Borzenkov
Subject: Re: Support abort of 'cat' even if in paging mode
Date: Sun, 18 Jan 2015 18:33:52 +0300

В Wed, 14 Jan 2015 11:49:57 +0100
Valentin Dornauer <address@hidden> пишет:

> 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 <address@hidden>.
> Thanks
> Valentin

reply via email to

[Prev in Thread] Current Thread [Next in Thread]