Purifier
Purifier copied to clipboard
Eliminate race condition in makeDirectory
This code should not check whether the directory exists.
With parallel tests running in the same code area, you have a race condition between these two points:
- does the directory exist
- create the directory
One test sees the directory does not exist, and tries to create it. At the same time another test has created it. Now the first test fails because the directory now exists.
To fix this, you should not check anything and use the force option which this PR implements - if the directory exists at the time of creation, it will ignore it and carry on with the rest of the process.