There is a race condition in this code. This doesn't totally fix it, if another process is creating and deleting the directory quickly, but it will help.

svn: r16996
This commit is contained in:
Jay McCarthy 2009-11-23 17:20:41 +00:00
parent 54adde155a
commit 342fb61208

View File

@ -65,7 +65,13 @@
(not (directory-exists? base)))
(make-directory* base))
(unless (directory-exists? dir)
(make-directory dir))))
(with-handlers ([exn:fail:filesystem?
(lambda (x)
(unless (and (regexp-match #rx"cannot make directory:.+File exists"
(exn-message x))
(directory-exists? dir))
(raise x)))])
(make-directory dir)))))
(define (make-temporary-file [template "mztmp~a"] [copy-from #f] [base-dir #f])
(with-handlers ([exn:fail:contract?