diff options
author | Brian Dolbec <brian.dolbec@gmail.com> | 2011-03-27 19:50:10 -0700 |
---|---|---|
committer | Brian Dolbec <brian.dolbec@gmail.com> | 2011-03-27 19:50:10 -0700 |
commit | 58530ac4e610f8eb9952ba8ee7ca920d400915db (patch) | |
tree | 977bfa5eafef6ba4f8ce54d1b332c3ef7b6c02b5 /layman/output.py | |
parent | eab52f261bda8aef53675271357b3ca742f865ad (diff) | |
download | layman-58530ac4e610f8eb9952ba8ee7ca920d400915db.tar.gz layman-58530ac4e610f8eb9952ba8ee7ca920d400915db.tar.bz2 layman-58530ac4e610f8eb9952ba8ee7ca920d400915db.zip |
fix double output for info sent to output.error() due to callback.
Diffstat (limited to 'layman/output.py')
-rw-r--r-- | layman/output.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/layman/output.py b/layman/output.py index caccd93..06161ca 100644 --- a/layman/output.py +++ b/layman/output.py @@ -49,6 +49,7 @@ class MessageBase(object): # callback function that gets passed any error messages # that have shown up. self.error_callback = error_callback + self.block_callback = False def _color (self, col, text): @@ -81,7 +82,7 @@ class MessageBase(object): """runs the error_callback function with the error that occurred """ - if self.error_callback: + if self.error_callback is not None and not self.block_callback: self.error_callback(error) @@ -135,7 +136,7 @@ class Message(MessageBase): lines = message.split('\n') - if not lines: + if not len(lines): return for i in lines[0:-1]: @@ -179,7 +180,7 @@ class Message(MessageBase): # stay in nice order. This is a workaround for calls like # "layman -L |& less". sys.stdout.flush() - print(self.color_func('red', '* ') + i, file=self.error_out) + print(self.color_func('red', '* ') + i, file=self.std_out) self.error_out.flush() self.do_error_callback(error) |