Commit 971e3328 authored by Boris Kocherov's avatar Boris Kocherov

yformat: raise on empty outputfile and returncode != 0

parent fc6e4976
...@@ -127,14 +127,18 @@ class Handler(object): ...@@ -127,14 +127,18 @@ class Handler(object):
env=self.environment, env=self.environment,
stdout=PIPE, stdout=PIPE,
stderr=PIPE, stderr=PIPE,
close_fds=True,
) )
# stdout, stderr = p.communicate() stdout, stderr = p.communicate()
ret = p.wait() file_content = open(output_file.name).read()
# logger.debug(stdout) return_code_msg = "yformat convert x2t return:{}".format(p.returncode)
# logger.debug(stderr) if p.returncode != 0 or not file_content:
logger.debug("yformat convert x2t return:{}".format(ret)) raise Exception(return_code_msg + '\n' + stderr)
logger.debug(stdout)
logger.debug(stderr)
logger.debug("yformat convert x2t return:{}".format(p.returncode))
self.file.trash() self.file.trash()
return open(output_file.name).read() return file_content
def getMetadata(self, base_document=False): def getMetadata(self, base_document=False):
"""Returns a dictionary with all metadata of document. """Returns a dictionary with all metadata of document.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment