Skip to content
Browse files

Updates

  • Loading branch information...
1 parent 0a1f99f commit 69a38b675f052ede71ac788691479cbf3e0e8a7b @dagwieers committed Apr 3, 2006
Showing with 14 additions and 4 deletions.
  1. +1 −0 ChangeLog
  2. +13 −4 dstat
View
1 ChangeLog
@@ -3,6 +3,7 @@
- Print out terminal debug info (TERM env and terminal type)
- Added SwapCached value to Cached (Bert de Bruijn)
- Added external plugin dstat_clock, a human-readable alternative for dstat_time
+- Fixed problem with Broken pipe when doing eg. dstat | head -1 (Eike Herzbach)
* 0.6.1 - Fishkill - released 05/09/2005
- Look for plugins in ~/.dstat/ too
View
17 dstat
@@ -1769,15 +1769,19 @@ def main():
### If intermediate results, update increases with 1 sec (=interval)
update = update + interval
+ if not op.update:
+ sys.stdout.write('\n')
+
### Do not pause when this is the final loop
if update <= op.delay * op.count or op.count == -1:
signal.pause()
### The last step in a loop is to show the definitive line on its own line
- if step == op.delay:
- sys.stdout.write('\n' + ansi['reset'] + ansi['clearline'] + ansi['save'])
- else:
- sys.stdout.write(ansi['clearline'] + ansi['restore'])
+ if op.update:
+ if step == op.delay:
+ sys.stdout.write('\n' + ansi['reset'] + ansi['clearline'] + ansi['save'])
+ else:
+ sys.stdout.write(ansi['clearline'] + ansi['restore'])
loop = (update + op.delay - 1) / op.delay
step = ((update - 1) % op.delay) + 1
@@ -1799,6 +1803,11 @@ if __name__ == '__main__':
main()
except KeyboardInterrupt, e:
print
+ except IOError, e:
+ if e.errno != 32: ## [Errno 32] Broken pipe
+ print
+ print 'IOError: %s' % e
+ exit(7)
except OSError, e:
print
print 'OSError: %s' % e

0 comments on commit 69a38b6

Please sign in to comment.
Something went wrong with that request. Please try again.