From dc350ed2b518858eb5bc74adf17c1d1a8061c39c Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Thu, 12 Mar 2009 10:58:21 +0000 Subject: [PATCH] pygrub: Workaround for Solaris CR 1143256. The Solaris curses library has a broken timeout() function: after a first timeout() call with a positive value for an argument, subsequent calls will fail to reset it. So, getch() always times out, confusing the pygrub timer in the main loop. Add an extra check to avoid exiting prematurely. Signed-off-by: Frank van der Linden --- tools/pygrub/src/pygrub | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tools/pygrub/src/pygrub b/tools/pygrub/src/pygrub index 0bd4578b9e..98b4352b85 100644 --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -441,7 +441,11 @@ class Grub: # Timed out waiting for a keypress if mytime != -1: mytime += 1 - if mytime >= int(timeout): + # curses.timeout() does not work properly on Solaris + # So we may come here even after a key has been pressed. + # Check both timeout and mytime to avoid exiting + # when we shouldn't. + if timeout != -1 and mytime >= int(timeout): self.isdone = True break else: -- 2.30.2