@@ -34463,17 +34463,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
34463
34463
const glob = __importStar(__webpack_require__(281));
34464
34464
const core = __importStar(__webpack_require__(470));
34465
34465
const exec = __importStar(__webpack_require__(986));
34466
+ const child_process = __importStar(__webpack_require__(129));
34467
+ const util_1 = __importDefault(__webpack_require__(669));
34466
34468
const path = __importStar(__webpack_require__(622));
34467
34469
const os_1 = __importDefault(__webpack_require__(87));
34468
34470
const cache_distributor_1 = __importDefault(__webpack_require__(435));
34471
+ const utils_1 = __webpack_require__(163);
34469
34472
class PipCache extends cache_distributor_1.default {
34470
34473
constructor(pythonVersion, cacheDependencyPath = '**/requirements.txt') {
34471
34474
super('pip', cacheDependencyPath);
34472
34475
this.pythonVersion = pythonVersion;
34473
34476
}
34474
34477
getCacheGlobalDirectories() {
34475
34478
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
+ }
34477
34498
if (exitCode && stderr) {
34478
34499
throw new Error(`Could not get cache folder path for pip package manager`);
34479
34500
}
0 commit comments