@@ -34463,17 +34463,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
3446334463const glob = __importStar(__webpack_require__(281));
3446434464const core = __importStar(__webpack_require__(470));
3446534465const exec = __importStar(__webpack_require__(986));
34466+ const child_process = __importStar(__webpack_require__(129));
34467+ const util_1 = __importDefault(__webpack_require__(669));
3446634468const path = __importStar(__webpack_require__(622));
3446734469const os_1 = __importDefault(__webpack_require__(87));
3446834470const cache_distributor_1 = __importDefault(__webpack_require__(435));
34471+ const utils_1 = __webpack_require__(163);
3446934472class PipCache extends cache_distributor_1.default {
3447034473 constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') {
3447134474 super('pip', cacheDependencyPath);
3447234475 this.pythonVersion = pythonVersion;
3447334476 }
3447434477 getCacheGlobalDirectories() {
3447534478 return __awaiter(this, void 0, void 0, function* () {
34476- const { stdout, stderr, exitCode } = yield exec.getExecOutput('pip cache dir');
34479+ let exitCode = 1;
34480+ let stdout = '';
34481+ let stderr = '';
34482+ // Add temporary fix for Windows
34483+ // On windows it is necessary to execute through an exec
34484+ // because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2,
34485+ // or spawn must be started with the shell option enabled for getExecOutput
34486+ // Related issue: https://github.com/actions/setup-python/issues/328
34487+ if (utils_1.IS_WINDOWS) {
34488+ const execPromisify = util_1.default.promisify(child_process.exec);
34489+ ({ stdout: stdout, stderr: stderr } = yield execPromisify('pip cache dir'));
34490+ }
34491+ else {
34492+ ({
34493+ stdout: stdout,
34494+ stderr: stderr,
34495+ exitCode: exitCode
34496+ } = yield exec.getExecOutput('pip cache dir'));
34497+ }
3447734498 if (exitCode && stderr) {
3447834499 throw new Error(`Could not get cache folder path for pip package manager`);
3447934500 }
0 commit comments