summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-01-30 19:22:16 +0000
committerLars Wirzenius <liw@liw.fi>2011-01-30 19:22:16 +0000
commit86c254a187349ce85fdefbad4a2aeb10c41acda3 (patch)
treee44dd021985eb76a051fa3e5ca3109daf390f2c3
parent9da02197510faff59aed2ae41289c6be17853c7d (diff)
downloadpython-ttystatus-86c254a187349ce85fdefbad4a2aeb10c41acda3.tar.gz
Disable output if there's an error.
-rw-r--r--ttystatus/messager.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ttystatus/messager.py b/ttystatus/messager.py
index 5e698c0..ce30e73 100644
--- a/ttystatus/messager.py
+++ b/ttystatus/messager.py
@@ -76,13 +76,13 @@ class Messager(object):
def _raw_write(self, string):
'''Write raw data if output is terminal.'''
+
if self._enabled and self.output and self.output.isatty():
try:
self.output.write(string)
+ self.output.flush()
except IOError: # pragma: no cover
- # Ignored on purpose.
- pass
- self.output.flush()
+ self._enabled = False
def _overwrite(self, string):
'''Overwrite current message on terminal.'''