From f5dfd50227810259e9e83d486d9c4b5a4e290458 Mon Sep 17 00:00:00 2001 From: Frank Quinn Date: Sun, 29 Nov 2020 14:09:21 +0000 Subject: [PATCH] Added timeout to imagemagick (#23) --- wsl_windows_toolbar.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wsl_windows_toolbar.py b/wsl_windows_toolbar.py index 0414229..e8eb6fc 100755 --- a/wsl_windows_toolbar.py +++ b/wsl_windows_toolbar.py @@ -436,9 +436,9 @@ def create_windows_icon(icon, if has_imagemagick: logger.debug("Could not convert using python methods - falling back on imagemagick") try: - subprocess.check_output(["convert", icon_path, png_file]) + subprocess.check_output(["convert", icon_path, png_file], timeout=10) logger.debug("Converted %s to %s using imagemagick", icon_path, png_file) - except subprocess.CalledProcessError: + except (subprocess.CalledProcessError, subprocess.TimeoutExpired): logger.exception("Failed to create or find png file for %s - icon will not be available (%s: %s)", icon_path, type(e).__name__, e) png_file = None