add cache
This commit is contained in:
parent
bd18a473d4
commit
5af754d685
1 changed files with 9 additions and 6 deletions
|
|
@ -28,13 +28,16 @@ when isMainModule:
|
||||||
texFile = workingDir / pad & ".tex"
|
texFile = workingDir / pad & ".tex"
|
||||||
pdfFile = workingDir / pad & ".pdf"
|
pdfFile = workingDir / pad & ".pdf"
|
||||||
|
|
||||||
writeFile(texFile, content)
|
if fileExists(texFile) and readFile(texFile) == content and fileExists(pdfFile):
|
||||||
|
# Use file from cache
|
||||||
let (output, exitCode) = execCmdEx(quoteShellCommand(["pdflatex", "-halt-on-error", texFile]))
|
resp(Http200, readFile(pdfFile), contentType="application/pdf")
|
||||||
if exitCode == 0:
|
|
||||||
resp(Http200, readFile(pdfFile), contentType = "application/pdf")
|
|
||||||
else:
|
else:
|
||||||
resp output
|
writeFile(texFile, content)
|
||||||
|
let (output, exitCode) = execCmdEx(quoteShellCommand(["pdflatex", "-halt-on-error", texFile]))
|
||||||
|
if exitCode == 0:
|
||||||
|
resp(Http200, readFile(pdfFile), contentType="application/pdf")
|
||||||
|
else:
|
||||||
|
resp output
|
||||||
|
|
||||||
let s = newSettings(port=Port(opts.port.parseInt))
|
let s = newSettings(port=Port(opts.port.parseInt))
|
||||||
var j = initJester(main, settings=s)
|
var j = initJester(main, settings=s)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue