[svn] r6219 - trunk/tools/dstat

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Fri Mar 14 19:46:57 CET 2008


Author: dag
Date: 2008-03-14 18:46:56 +0000 (Fri, 14 Mar 2008)
New Revision: 6219

Modified:
   trunk/tools/dstat/ChangeLog
   trunk/tools/dstat/TODO
   trunk/tools/dstat/dstat
Log:
Fixed the IOError when terminal is suspended and IO is unbuffered. (Dbt 309953)

Modified: trunk/tools/dstat/ChangeLog
===================================================================
--- trunk/tools/dstat/ChangeLog	2008-03-14 16:38:04 UTC (rev 6218)
+++ trunk/tools/dstat/ChangeLog	2008-03-14 18:46:56 UTC (rev 6219)
@@ -1,7 +1,8 @@
-* 0.6.7svn - ... - release 09/03/2008
+* 0.6.7svn - ... - release 14/03/2008
 - Added improved tick patch (Kelly Long)
 - Show milliseconds in dstat_time when using --debug cfr. dstat_epoch
 - Difference in integer rounding should not affect colouring
+- Fixed the IOError when terminal is suspended and IO is unbuffered. (Dbt 309953)
 
 * 0.6.7 - Cambridge overdue - released 26/02/2008
 - Only rewrite xterm title when XTERM_SHELL is set to bash

Modified: trunk/tools/dstat/TODO
===================================================================
--- trunk/tools/dstat/TODO	2008-03-14 16:38:04 UTC (rev 6218)
+++ trunk/tools/dstat/TODO	2008-03-14 18:46:56 UTC (rev 6219)
@@ -57,7 +57,6 @@
 + Python 1.5 prints 'L' for long, crashes when int()
 + Implement better (?) protection against counter rollovers (see mail from Sebastien Prud'homme)
 + Plugins currently have to be written in python 1.5 to work for dstat15 (lowest common denominator)
-+ Because output is unbiffered, when stdout is suspendes (Ctrl-S) you get: IOError: [Errno 4] Interrupted system call (Dbt 309953, Marc Lehmann, supastuff at freenode)
 
 ### Plugin issues
 + plugins that use /proc/pid are reasonably slow

Modified: trunk/tools/dstat/dstat
===================================================================
--- trunk/tools/dstat/dstat	2008-03-14 16:38:04 UTC (rev 6218)
+++ trunk/tools/dstat/dstat	2008-03-14 18:46:56 UTC (rev 6219)
@@ -1625,7 +1625,7 @@
     termsize = None, None
 
     ### Unbuffered sys.stdout
-    sys.stdout = os.fdopen(1, 'w', 0)
+#   sys.stdout = os.fdopen(1, 'w', 0)
 
     try:
         global fcntl, struct, termios
@@ -1976,6 +1976,10 @@
             showtitle(1, totlist, vislist, ansi['darkblue'] + char['space'], ansi['darkblue'] + char['gt'])
             showtitle(2, totlist, vislist, ansi['gray'] + char['pipe'], ansi['darkblue'] + char['gt'])
 
+        ### Flush output since this is buffered I/O
+        try: sys.stdout.flush()
+        except IOError: pass
+
         ### Prepare the colors for intermediate updates, last step in a loop is definitive
         if step == op.delay:
             ansi['default'] = ansi['reset']
@@ -2019,6 +2023,10 @@
         if not op.update:
             sys.stdout.write('\n')
 
+        ### Flush output since this is buffered I/O
+        try: sys.stdout.flush()
+        except IOError: pass
+
         ### Do not pause when this is the final loop
         if update <= op.delay * op.count or op.count == -1:
             signal.pause()



More information about the svn-commits mailing list