Skip to content

Commit

Permalink
fix(access-token): avoid clobbering temporary json-store files
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfig committed Jul 28, 2021
1 parent ffc68bf commit d468531
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/access-token/src/json-store.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
import fs from 'fs';
import path from 'path';
import process from 'process';
import Readlines from 'n-readlines';

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

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

0 comments on commit d468531

Please sign in to comment.