Commit 6584228e authored by Boris Kocherov's avatar Boris Kocherov

yformat: care of file close. @gabriel thanks

parent 971e3328
...@@ -130,7 +130,8 @@ class Handler(object): ...@@ -130,7 +130,8 @@ class Handler(object):
close_fds=True, close_fds=True,
) )
stdout, stderr = p.communicate() stdout, stderr = p.communicate()
file_content = open(output_file.name).read() with open(output_file.name) as output_file1:
file_content = output_file1.read()
return_code_msg = "yformat convert x2t return:{}".format(p.returncode) return_code_msg = "yformat convert x2t return:{}".format(p.returncode)
if p.returncode != 0 or not file_content: if p.returncode != 0 or not file_content:
raise Exception(return_code_msg + '\n' + stderr) raise Exception(return_code_msg + '\n' + stderr)
......
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