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

[Xen-changelog] Fix pygrub to handle timeout of -1 (wait forever).



# HG changeset patch
# User john.levon@xxxxxxx
# Node ID 859c8d66b203134180820d694191731d2c195336
# Parent  e9d78d8bd568d4be0461bb5b09007fd2ccc4a707
Fix pygrub to handle timeout of -1 (wait forever).
Only call use_default_colors() if it's available.

Signed-off-by: John Levon <john.levon@xxxxxxx>

diff -r e9d78d8bd568 -r 859c8d66b203 tools/pygrub/src/pygrub
--- a/tools/pygrub/src/pygrub   Tue Feb  7 20:38:44 2006
+++ b/tools/pygrub/src/pygrub   Tue Feb  7 20:46:13 2006
@@ -29,7 +29,8 @@
 
 def draw_window():
     stdscr = curses.initscr()
-    curses.use_default_colors()
+    if hasattr(curses, 'use_default_colors'):
+        curses.use_default_colors()
     try:
         curses.curs_set(0)
     except _curses.error:
@@ -152,15 +153,16 @@
 
 def main(cf = None):
     mytime = 0
+    timeout = int(cf.timeout)
 
     (stdscr, win) = draw_window()
     stdscr.timeout(1000)
     selected = cf.default
     
-    while (mytime < int(cf.timeout)):
-        if cf.timeout != -1 and mytime != -1: 
+    while (timeout == -1 or mytime < int(timeout)):
+        if timeout != -1 and mytime != -1: 
             stdscr.addstr(20, 5, "Will boot selected entry in %2d seconds"
-                          %(int(cf.timeout) - mytime))
+                          %(int(timeout) - mytime))
         else:
             stdscr.addstr(20, 5, " " * 80)
             

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.