Skip to content

Commit 86cf920

Browse files
authored
fix(gatsby): Use tmp dir for tmp redux cache folder (#22959)
1 parent a10382d commit 86cf920

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/gatsby/src/redux/persist.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import path from "path"
2+
import os from "os"
23
import v8 from "v8"
34
import {
45
existsSync,
@@ -139,7 +140,7 @@ export function writeToCache(contents: ICachedReduxState): void {
139140
// Note: this should be a transactional operation. So work in a tmp dir and
140141
// make sure the cache cannot be left in a corruptable state due to errors.
141142

142-
const tmpDir = mkdtempSync(`reduxcache`) // linux / windows
143+
const tmpDir = mkdtempSync(path.join(os.tmpdir(), `reduxcache`)) // linux / windows
143144

144145
prepareCacheFolder(tmpDir, contents)
145146

0 commit comments

Comments
 (0)