mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Improve error handling when pandoc is missing
This commit is contained in:
parent
d7f0b1637e
commit
2f79d5f052
1 changed files with 15 additions and 1 deletions
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import argparse
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
|
@ -217,7 +218,20 @@ def fields2pelican(fields, out_markup, output_path, dircat=False):
|
|||
content = content.replace("\n", "<br />\n")
|
||||
fp.write(content)
|
||||
|
||||
os.system('pandoc --normalize --reference-links --from=html --to=%s -o "%s" "%s"' % (out_markup, out_filename, html_filename))
|
||||
cmd = 'pandoc --normalize --reference-links --from=html --to={0} -o "{1}" "{2}"'.format(
|
||||
out_markup, out_filename, html_filename)
|
||||
|
||||
try:
|
||||
rc = subprocess.call(cmd, shell=True)
|
||||
if rc < 0:
|
||||
print("Child was terminated by signal %d" % -rc)
|
||||
exit()
|
||||
elif rc > 0:
|
||||
print("Please, check your Pandoc installation.")
|
||||
exit()
|
||||
except OSError, e:
|
||||
print("Pandoc execution failed: %s" % e)
|
||||
exit()
|
||||
|
||||
os.remove(html_filename)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue