Mercurial > hg
comparison hgext/blackbox.py @ 28025:ab6468270b83
blackbox: flush output file descriptor
Without this, when there are multiple ui views, each blackbox
will have its own file handle, and the logging will be in
a really bad order.
Also, because of the way blackbox works, it never closes its
file handles, which means the last output before exit is
often lost.
author | timeless <timeless@mozdev.org> |
---|---|
date | Wed, 03 Feb 2016 15:18:29 +0000 |
parents | e8f9dffca36f |
children | a6db1163befa |
comparison
equal
deleted
inserted
replaced
28024:142891ab6e89 | 28025:ab6468270b83 |
---|---|
110 pid = str(os.getpid()) | 110 pid = str(os.getpid()) |
111 formattedmsg = msg[0] % msg[1:] | 111 formattedmsg = msg[0] % msg[1:] |
112 try: | 112 try: |
113 blackbox.write('%s %s (%s)> %s' % | 113 blackbox.write('%s %s (%s)> %s' % |
114 (date, user, pid, formattedmsg)) | 114 (date, user, pid, formattedmsg)) |
115 blackbox.flush() | |
115 except IOError as err: | 116 except IOError as err: |
116 self.debug('warning: cannot write to blackbox.log: %s\n' % | 117 self.debug('warning: cannot write to blackbox.log: %s\n' % |
117 err.strerror) | 118 err.strerror) |
118 lastblackbox = blackbox | 119 lastblackbox = blackbox |
119 | 120 |