Skip to content

Commit d468531

Browse files
committed
fix(access-token): avoid clobbering temporary json-store files
1 parent ffc68bf commit d468531

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/access-token/src/json-store.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// @ts-check
22
import fs from 'fs';
33
import path from 'path';
4+
import process from 'process';
45
import Readlines from 'n-readlines';
56

67
// TODO: Update this when we make a breaking change.
@@ -198,7 +199,7 @@ function makeJSONStore(dirPath, forceReset = false) {
198199
*/
199200
function commit() {
200201
if (dirPath) {
201-
const tempFile = `${storeFile}.tmp`;
202+
const tempFile = `${storeFile}-${process.pid}.tmp`;
202203
const fd = fs.openSync(tempFile, 'w');
203204

204205
for (const [key, value] of state.entries()) {

0 commit comments

Comments
 (0)