mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 02:34:06 -04:00
close stdout/err handles before opening debug log
There is an unconfirmed report about file in use errors, most likely the handles are inherited by some other process or an antivirus or whatever, but lets at least close them in the under our control. Windows is such a pain.
This commit is contained in:
parent
4a6165bc42
commit
4dbdea4122
@ -434,6 +434,8 @@ def run_gui_(opts, args, app, gui_debug=None):
|
|||||||
debugfile = runner.main.gui_debug
|
debugfile = runner.main.gui_debug
|
||||||
from calibre.gui2 import open_local_file
|
from calibre.gui2 import open_local_file
|
||||||
if iswindows:
|
if iswindows:
|
||||||
|
# detach the stdout/stderr/stdin handles
|
||||||
|
winutil.prepare_for_restart()
|
||||||
with open(debugfile, 'r+b') as f:
|
with open(debugfile, 'r+b') as f:
|
||||||
raw = f.read()
|
raw = f.read()
|
||||||
raw = re.sub(b'(?<!\r)\n', b'\r\n', raw)
|
raw = re.sub(b'(?<!\r)\n', b'\r\n', raw)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user