This change ensures that we only overwrite files if generation succeeds.
Previously we were opening the file and truncating before doing the
generation. Now we generate in memory and then write out to disk. For
extra security, use an atomic writefile that ensures we won't write half
a file.
In addition, refactor the generation so the meat of the code is the same
for everything.
This change ensures that we only overwrite files if generation succeeds. Previously we were opening the file and truncating before doing the generation. Now we generate in memory and then write out to disk. For extra security, use an atomic writefile that ensures we won't write half a file.
In addition, refactor the generation so the meat of the code is the same for everything.