[master/rhel7/f21][PATCH] Check if we read something when emptying stdin queue
Samantha N. Bueno
sbueno+anaconda at redhat.com
Thu Nov 13 18:08:18 UTC 2014
On Thu, Nov 13, 2014 at 06:55:39PM +0100, Vratislav Podzimek wrote:
> In some cases (looking at you s390x again) select may report there's something
> on stdin while there's nothing and stdin.read(1) returns nothing. If that
> happens, we are good to stop reading from stdin because there's nothing queued.
The biggest ack in the world to this.
>
> Related: rhbz#1162702
> Signed-off-by: Vratislav Podzimek <vpodzime at redhat.com>
> ---
> pyanaconda/ui/lib/entropy.py | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/pyanaconda/ui/lib/entropy.py b/pyanaconda/ui/lib/entropy.py
> index 52e595d..401053b 100644
> --- a/pyanaconda/ui/lib/entropy.py
> +++ b/pyanaconda/ui/lib/entropy.py
> @@ -116,9 +116,10 @@ def _tui_wait(msg, desired_entropy):
>
> # and then just read everything from the input buffer and revert the
> # termios state
> - while sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
> + data = "have something"
> + while sys.stdin in select.select([sys.stdin], [], [], 0)[0] and data:
> # just read from stdin and scratch the read data
> - sys.stdin.read(1)
> + data = sys.stdin.read(1)
>
> if termios_attrs_changed:
> termios.tcsetattr(fd, termios.TCSAFLUSH, old)
> --
> 1.9.3
>
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
More information about the anaconda-patches
mailing list