Permalink
Browse files

TERM environment variable fix from William Webber

  • Loading branch information...
1 parent 193064d commit 390fb275f64f3e6f0fd577fde943c0d79084d3f7 @dagwieers committed Sep 6, 2005
Showing with 8 additions and 3 deletions.
  1. +3 −0 ChangeLog
  2. +3 −2 dstat
  3. +2 −1 dstat15
View
@@ -1,3 +1,6 @@
+* 0.6.2 - ? - released ??/??/2005
+- Fixed situation where no TERM environment variable was set (William Webber)
+
* 0.6.1 - Fishkill - released 05/09/2005
- Look for plugins in ~/.dstat/ too
- Added '-M list' to show the list of available modules per path
View
5 dstat
@@ -1483,7 +1483,7 @@ def getwinsize():
return struct.unpack('HHHH', x)[:2]
except:
try:
- return int(os.environ['LINES']), int(os.environ['COLUMNS'])
+ return int(os.getenv('LINES')), int(os.getenv('COLUMNS'))
except:
return 25, 80
@@ -1589,7 +1589,8 @@ def main():
hostname = os.uname()[1].split('.')[0]
### Write term-title
- if re.compile('(screen*|xterm*)').match(os.getenv('TERM')):
+ term = os.getenv('TERM')
+ if term and re.compile('(screen*|xterm*)').match(term):
sys.stdout.write('\033]0;(%s@%s) %s %s\007' % (user, hostname, os.path.basename(sys.argv[0]), ' '.join(op.args)))
### Check terminal capabilities
View
@@ -1589,7 +1589,8 @@ def main():
hostname = string.split(os.uname()[1], '.')[0]
### Write term-title
- if re.compile('(screen*|xterm*)').match(os.environ['TERM']):
+ term = os.environ['TERM']
+ if term and re.compile('(screen*|xterm*)').match(term):
sys.stdout.write('\033]0;(%s@%s) %s %s\007' % (user, hostname, os.path.basename(sys.argv[0]), string.join(op.args, ' ')))
### Check terminal capabilities

0 comments on commit 390fb27

Please sign in to comment.