nimpretty: fixes #9499

(cherry picked from commit 5fd2827ab6)
This commit is contained in:
Andreas Rumpf
2018-10-25 07:52:27 +02:00
committed by narimiran
parent 4b06f19b71
commit 6844d679fc

View File

@@ -55,9 +55,13 @@ proc openEmitter*(em: var Emitter, cache: IdentCache;
em.lastLineNumber = 1
proc closeEmitter*(em: var Emitter) =
if fileExists(em.config.outFile) and readFile(em.config.outFile.string) == em.content:
discard "do nothing, see #9499"
return
var f = llStreamOpen(em.config.outFile, fmWrite)
if f == nil:
rawMessage(em.config, errGenerated, "cannot open file: " & em.config.outFile.string)
return
f.llStreamWrite em.content
llStreamClose(f)