From 373c62e5cbcd27a4e497e61b44cda89911f38807 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sat, 10 Feb 2024 19:47:50 +1100 Subject: [PATCH] Use subprocess with CREATE_NO_WINDOW flag in WindowsViewer --- src/PIL/ImageShow.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/PIL/ImageShow.py b/src/PIL/ImageShow.py index c03122c11aa..4a801e5b0fb 100644 --- a/src/PIL/ImageShow.py +++ b/src/PIL/ImageShow.py @@ -138,6 +138,17 @@ def get_command(self, file: str, **options: Any) -> str: f'&& del /f "{file}"' ) + def show_file(self, path: str, **options: Any) -> int: + """ + Display given file. + """ + subprocess.Popen( + self.get_command(path, **options), + shell=True, + creationflags=getattr(subprocess, "CREATE_NO_WINDOW"), + ) # nosec + return 1 + if sys.platform == "win32": register(WindowsViewer)