Skip to content

Commit

Permalink
Fix sphinx-doc#8938: imgconverter: Show the error of the command avai…
Browse files Browse the repository at this point in the history
…lability check

imgconverter extension suppresses an OSError like "Cannot allocate
memory" unexpectedly.  So the error should be shown with the warning.
  • Loading branch information
tk0miya committed Feb 27, 2021
1 parent 4f7f330 commit 347ae4f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ Features added
* #2018: html: :confval:`html_favicon` and :confval:`html_logo` now accept URL
for the image
* #8070: html search: Support searching for 2characters word
* #8938: imgconverter: Show the error of the command availability check
* #7830: Add debug logs for change detection of sources and templates
* #8201: Emit a warning if toctree contains duplicated entries

Expand Down
6 changes: 3 additions & 3 deletions sphinx/ext/imgconverter.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def is_available(self) -> bool:
logger.debug('Invoking %r ...', args)
subprocess.run(args, stdout=PIPE, stderr=PIPE, check=True)
return True
except OSError:
except OSError as exc:
logger.warning(__('convert command %r cannot be run, '
'check the image_converter setting'),
self.config.image_converter)
'check the image_converter setting: %s'),
self.config.image_converter, exc)
return False
except CalledProcessError as exc:
logger.warning(__('convert exited with error:\n'
Expand Down

0 comments on commit 347ae4f

Please sign in to comment.