| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -54331,24 +54331,29 @@ class PipCache extends cache_distributor_1.default { | |||
| 54331 | 54331 | this.pythonVersion = pythonVersion; | |
| 54332 | 54332 | } | |
| 54333 | 54333 | async getCacheGlobalDirectories() { | |
| 54334 | - let exitCode = 1; | ||
| 54334 | + let exitCode = 0; | ||
| 54335 | 54335 | let stdout = ''; | |
| 54336 | 54336 | let stderr = ''; | |
| 54337 | 54337 | // Add temporary fix for Windows | |
| 54338 | - // On windows it is necessary to execute through an exec | ||
| 54339 | - // because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2, | ||
| 54338 | + // On Windows, it is necessary to execute through an exec | ||
| 54339 | + // because the getExecOutput gives a non-zero code or writes to stderr for pip 22.0.2, | ||
| 54340 | 54340 | // or spawn must be started with the shell option enabled for getExecOutput | |
| 54341 | 54341 | // Related issue: https://github.com/actions/setup-python/issues/328 | |
| 54342 | 54342 | if (utils_1.IS_WINDOWS) { | |
| 54343 | 54343 | const execPromisify = util_1.default.promisify(child_process.exec); | |
| 54344 | - ({ stdout: stdout, stderr: stderr } = await execPromisify('pip cache dir')); | ||
| 54344 | + try { | ||
| 54345 | + ({ stdout, stderr } = await execPromisify('pip cache dir')); | ||
| 54346 | + } | ||
| 54347 | + catch (err) { | ||
| 54348 | + // Pip outputs warnings to stderr (e.g., --no-python-version-warning flag deprecation warning), causing false failure detection | ||
| 54349 | + // Related issue: https://github.com/actions/setup-python/issues/1034 | ||
| 54350 | + // If an error occurs, capture stderr and set exitCode to 1 to indicate failure | ||
| 54351 | + stderr = err.stderr ?? err.message; | ||
| 54352 | + exitCode = 1; | ||
| 54353 | + } | ||
| 54345 | 54354 | } | |
| 54346 | 54355 | else { | |
| 54347 | - ({ | ||
| 54348 | - stdout: stdout, | ||
| 54349 | - stderr: stderr, | ||
| 54350 | - exitCode: exitCode | ||
| 54351 | - } = await exec.getExecOutput('pip cache dir')); | ||
| 54356 | + ({ stdout, stderr, exitCode } = await exec.getExecOutput('pip cache dir')); | ||
| 54352 | 54357 | } | |
| 54353 | 54358 | if (exitCode && stderr) { | |
| 54354 | 54359 | throw new Error(`Could not get cache folder path for pip package manager`); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,24 +21,28 @@ class PipCache extends CacheDistributor { | |||
| 21 | 21 | } | |
| 22 | 22 | ||
| 23 | 23 | protected async getCacheGlobalDirectories() { | |
| 24 | - let exitCode = 1; | ||
| 24 | + let exitCode = 0; | ||
| 25 | 25 | let stdout = ''; | |
| 26 | 26 | let stderr = ''; | |
| 27 | 27 | ||
| 28 | 28 | // Add temporary fix for Windows | |
| 29 | - // On windows it is necessary to execute through an exec | ||
| 30 | - // because the getExecOutput gives a non zero code or writes to stderr for pip 22.0.2, | ||
| 29 | + // On Windows, it is necessary to execute through an exec | ||
| 30 | + // because the getExecOutput gives a non-zero code or writes to stderr for pip 22.0.2, | ||
| 31 | 31 | // or spawn must be started with the shell option enabled for getExecOutput | |
| 32 | 32 | // Related issue: https://github.com/actions/setup-python/issues/328 | |
| 33 | 33 | if (IS_WINDOWS) { | |
| 34 | 34 | const execPromisify = utils.promisify(child_process.exec); | |
| 35 | - ({stdout: stdout, stderr: stderr} = await execPromisify('pip cache dir')); | ||
| 35 | + try { | ||
| 36 | + ({stdout, stderr} = await execPromisify('pip cache dir')); | ||
| 37 | + } catch (err) { | ||
| 38 | + // Pip outputs warnings to stderr (e.g., --no-python-version-warning flag deprecation warning), causing false failure detection | ||
| 39 | + // Related issue: https://github.com/actions/setup-python/issues/1034 | ||
| 40 | + // If an error occurs, capture stderr and set exitCode to 1 to indicate failure | ||
| 41 | + stderr = (err as any).stderr ?? (err as Error).message; | ||
| 42 | + exitCode = 1; | ||
| 43 | + } | ||
| 36 | 44 | } else { | |
| 37 | - ({ | ||
| 38 | - stdout: stdout, | ||
| 39 | - stderr: stderr, | ||
| 40 | - exitCode: exitCode | ||
| 41 | - } = await exec.getExecOutput('pip cache dir')); | ||
| 45 | + ({stdout, stderr, exitCode} = await exec.getExecOutput('pip cache dir')); | ||
| 42 | 46 | } | |
| 43 | 47 | ||
| 44 | 48 | if (exitCode && stderr) { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments