Skip to content

Commit de9e71e

Browse files
committed
Ensure custom temp folder exists
1 parent f464126 commit de9e71e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

apps/rush-lib/src/scripts/install-run.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import * as path from 'path';
1919
import { IPackageJson } from '@microsoft/node-core-library';
2020

2121
export const RUSH_JSON_FILENAME: string = 'rush.json';
22-
const RUSH_TEMP_FOLDER: string = 'RUSH_TEMP_FOLDER';
22+
const RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME: string = 'RUSH_TEMP_FOLDER';
2323
const INSTALLED_FLAG_FILENAME: string = 'installed.flag';
2424
const NODE_MODULES_FOLDER_NAME: string = 'node_modules';
2525
const PACKAGE_JSON_FILENAME: string = 'package.json';
@@ -372,7 +372,16 @@ function writeFlagFile(packageInstallFolder: string): void {
372372
}
373373

374374
function getRushTempFolder(rushCommonFolder: string): string {
375-
return process.env[RUSH_TEMP_FOLDER] || ensureAndJoinPath(rushCommonFolder, 'temp');
375+
const rushTempFolder: string | undefined = process.env[RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME];
376+
if (rushTempFolder !== undefined) {
377+
if (!fs.existsSync(rushTempFolder)) {
378+
fs.mkdirSync(rushTempFolder);
379+
}
380+
381+
return rushTempFolder;
382+
}
383+
384+
return ensureAndJoinPath(rushCommonFolder, 'temp');
376385
}
377386

378387
export function installAndRun(

0 commit comments

Comments
 (0)