mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix passing stdout/stderr to RotatingLog not working
This commit is contained in:
parent
3a9dd02e04
commit
03e862aa70
@ -322,6 +322,13 @@ class RotatingStream(object):
|
|||||||
self.set_output()
|
self.set_output()
|
||||||
|
|
||||||
def set_output(self):
|
def set_output(self):
|
||||||
|
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
|
self.stream = share_open(self.filename, 'ab', -1 if iswindows else 1) # line buffered
|
||||||
try:
|
try:
|
||||||
self.current_pos = self.stream.tell()
|
self.current_pos = self.stream.tell()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user