mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 09:43:46 +02:00
py3: Fix passing stdout/stderr to RotatingLog not working
This commit is contained in:
parent
3a9dd02e04
commit
03e862aa70
1 changed files with 8 additions and 1 deletions
|
|
@ -322,7 +322,14 @@ def __init__(self, filename, max_size=None, history=5):
|
|||
self.set_output()
|
||||
|
||||
def set_output(self):
|
||||
self.stream = share_open(self.filename, 'ab', -1 if iswindows else 1) # line buffered
|
||||
if ispy3:
|
||||
if iswindows:
|
||||
self.stream = share_open(self.filename, 'ab')
|
||||
else:
|
||||
# see https://bugs.python.org/issue27805
|
||||
self.stream = open(os.open(self.filename, os.O_WRONLY|os.O_APPEND|os.O_CREAT|os.O_CLOEXEC), 'wb')
|
||||
else:
|
||||
self.stream = share_open(self.filename, 'ab', -1 if iswindows else 1) # line buffered
|
||||
try:
|
||||
self.current_pos = self.stream.tell()
|
||||
except EnvironmentError:
|
||||
|
|
|
|||
Loading…
Reference in a new issue