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):
env=self.environment,
stdout=PIPE,
stderr=PIPE,
close_fds=True,
)
# stdout, stderr = p.communicate()
ret = p.wait()
# logger.debug(stdout)
# logger.debug(stderr)
logger.debug("yformat convert x2t return:{}".format(ret))
stdout, stderr = p.communicate()
file_content = open(output_file.name).read()
return_code_msg = "yformat convert x2t return:{}".format(p.returncode)
if p.returncode != 0 or not file_content:
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()
return open(output_file.name).read()
return file_content
def getMetadata(self, base_document=False):
"""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