Skip to content

Commit

Permalink
fix(gatsby): Use tmp dir for tmp redux cache folder (#22959)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvdz authored Apr 9, 2020
1 parent a10382d commit 86cf920
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/gatsby/src/redux/persist.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import path from "path"
import os from "os"
import v8 from "v8"
import {
existsSync,
Expand Down Expand Up @@ -139,7 +140,7 @@ export function writeToCache(contents: ICachedReduxState): void {
// Note: this should be a transactional operation. So work in a tmp dir and
// make sure the cache cannot be left in a corruptable state due to errors.

const tmpDir = mkdtempSync(`reduxcache`) // linux / windows
const tmpDir = mkdtempSync(path.join(os.tmpdir(), `reduxcache`)) // linux / windows

prepareCacheFolder(tmpDir, contents)

Expand Down

0 comments on commit 86cf920

Please sign in to comment.