Skip to content

Commit 09d60c5

Browse files
committed
diagram-generator: fix issue introduced in tmpname change
The filename extension seems to matter.
1 parent 594daba commit 09d60c5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

diagram-generator/diagram-generator.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ end
170170
local function py2image(code, filetype)
171171

172172
-- Define the temp files:
173-
local outfile = os.tmpname()
173+
local outfile = string.format('%s.%s', os.tmpname(), filetype)
174174
local pyfile = os.tmpname()
175175

176176
-- Replace the desired destination's file type in the Python code:
@@ -197,6 +197,8 @@ local function py2image(code, filetype)
197197
if r then
198198
imgData = r:read("*all")
199199
r:close()
200+
else
201+
io.stderr:write(string.format("File '%s' could not be opened", outfile))
200202
end
201203

202204
-- Delete the tmp files:

0 commit comments

Comments
 (0)