joliss/node-quick-temp — pull request #3 by rjackson (2014-04-25 11:58:19+00:00)
Title: Do not reuse baseDir local var if working directory changes.

This change checks to confirm that `process.cwd` matches what it was when
`baseDir` was cached. If it has changed, we need to setup
`baseDir` again.

----

Before this change, the following would fail:

```javascript var fs = require('fs') var quickTemp = require('quick-temp')

var somePathObj = {} fs.mkdirSync('somePath') process.chdir('somePath')
quickTemp.makeOrRemake(somePathObj, 'tmpDestDir')

var someOtherPathObj = {} fs.mkdirSync('someOtherPath')
process.chdir('someOtherPath') quickTemp.makeOrRemake(someOtherPathObj,
'tmpDestDir')
```

This fails because the local `baseDir` var is set/cached with a value that
references `tmp`, but once `process.cwd` changes we don't check for the
existence of `tmp/` again.