We are using openBinaryTempFile in an unsafe manner here: the file gets
closed immediately inside withTemp, then, in the user specified closure
we reopen it and close it again (by calling copyFileOrUrl on the
filename). I guess openBinaryTempFile operates under the assumption that
after the file handle it returns is closed the caller is done with it
and the name can be re-used. I can reproduce this with a simple test
program where I get the same file name 20 times in a row.
Fixing this will require some refactoring.
|