Avoid race condition when displaying images with eog

Image.show() expects its display command to run synchronously, but eog
is asynchronous if there's another instance already running -- it just
asks the other instance to open the file and then immediately exits.
This causes intermittent failures where the file gets deleted before
the running eog instance manages to open it.

Fix this by using the -n option, so eog starts a new instance each time
instead of trying to reuse an existing one.
This commit is contained in:
Michael Constant 2021-05-22 23:56:44 -07:00
parent cc2db17271
commit 5c8aa277ce

View File

@ -207,7 +207,8 @@ class EogViewer(UnixViewer):
"""The GNOME Image Viewer ``eog`` command."""
def get_command_ex(self, file, **options):
command = executable = "eog"
executable = "eog"
command = "eog -n"
return command, executable