Skip to content

Commit 65c4b0f

Browse files
committed
fix: fix checking for pipx existence
1 parent 512202e commit 65c4b0f

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

dist/actions/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/actions/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/modern/setup-cpp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/python/python.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export async function setupPython(version: string, setupDir: string, arch: strin
4343

4444
async function setupPipx(foundPython: string) {
4545
try {
46-
if (!(await hasPipx())) {
46+
if (!(await hasPipx(foundPython))) {
4747
try {
4848
await setupPipPackWithPython(foundPython, "pipx", undefined, true)
4949
} catch (err) {

src/utils/setup/setupPipPack.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { info } from "@actions/core"
2-
import { execaSync } from "execa"
2+
import { execa, execaSync } from "execa"
33
import { pathExists } from "path-exists"
44
import { addExeExt, dirname, join } from "patha"
55
import which from "which"
@@ -22,7 +22,7 @@ export async function setupPipPackWithPython(
2222
upgrade = false,
2323
user = true,
2424
): Promise<InstallationInfo> {
25-
const isPipx = await hasPipx()
25+
const isPipx = await hasPipx(givenPython)
2626
const pip = isPipx ? "pipx" : "pip"
2727

2828
info(`Installing ${name} ${version ?? ""} via ${pip}`)
@@ -43,8 +43,8 @@ export async function setupPipPackWithPython(
4343
return { binDir }
4444
}
4545

46-
export async function hasPipx() {
47-
return (await which("pipx", { nothrow: true })) !== null
46+
export async function hasPipx(givenPython: string) {
47+
return (await execa(givenPython, ["-m", "pipx", "--help"], { stdio: "ignore", reject: false })).exitCode === 0
4848
}
4949

5050
async function getPython_raw(): Promise<string> {

0 commit comments

Comments
 (0)