[FIX] server: ignore broken symlinks
Previously broken symlinks would cause a FileNotFoundError exception in the filesystem watcher thread spawned when using the --dev=reload argument. This problem appeared when using emacs to edit python files while they are being watched by an odoo instance for changes. Emacs creates a broken symlink as lockfile in the same directory as the python file that it edits. This commit makes the filesystem watcher silently ignore any FileNotFoundError that occurs when it tries to open a file. Fixes #21214, closes #21215
This commit is contained in:
committed by
Jeremy Kersten
parent
d63de90a8a
commit
956b3ce54d
@@ -134,6 +134,8 @@ class FSWatcher(object):
|
||||
try:
|
||||
source = open(path, 'rb').read() + '\n'
|
||||
compile(source, path, 'exec')
|
||||
except FileNotFoundError:
|
||||
_logger.error('autoreload: python code change detected, FileNotFound for %s', path)
|
||||
except SyntaxError:
|
||||
_logger.error('autoreload: python code change detected, SyntaxError in %s', path)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user