Add support for closing a TemporaryFile early
authorChristopher Dykes <cdykes@fb.com>
Thu, 13 Jul 2017 18:50:36 +0000 (11:50 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Thu, 13 Jul 2017 18:57:20 +0000 (11:57 -0700)
commit050671f8b55500a11a12e7e29ac30f47039eb30a
tree1d952c99e5645d45ed7c9c709c1b1a3e1c21939c
parent6ecf60a979c5eb5d4e4edd0cd59393bb1c1931af
Add support for closing a TemporaryFile early

Summary:
The file itself will still get removed when `TemporaryFile` is destroyed, but closing it before then allows it to be read when on Windows, because `TemporaryFile` opens the temporary file with `O_EXCL`, so Windows denies read access of the file to everything else.
This is needed to fix one of the AsyncFileWriter tests on Windows.

Reviewed By: simpkins

Differential Revision: D5307719

fbshipit-source-id: bd65962cc3d34f382cc7b0b55dbf2659ed5ebfce
folly/experimental/TestUtil.cpp
folly/experimental/TestUtil.h
folly/experimental/test/TestUtilTest.cpp