Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use subprocess with CREATE_NO_WINDOW flag in ImageShow WindowsViewer #7791

Merged
merged 1 commit into from Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/PIL/ImageShow.py
Expand Up @@ -138,6 +138,17 @@
f'&& del /f "{file}"'
)

def show_file(self, path: str, **options: Any) -> int:
"""
Display given file.
"""
subprocess.Popen(

Check warning on line 145 in src/PIL/ImageShow.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/ImageShow.py#L145

Added line #L145 was not covered by tests
self.get_command(path, **options),
shell=True,
creationflags=getattr(subprocess, "CREATE_NO_WINDOW"),
) # nosec
return 1

Check warning on line 150 in src/PIL/ImageShow.py

View check run for this annotation

Codecov / codecov/patch

src/PIL/ImageShow.py#L150

Added line #L150 was not covered by tests


if sys.platform == "win32":
register(WindowsViewer)
Expand Down