Skip to content

Commit 4c53c5d

Browse files
authored
fix(installation): don't misdetect npm/pipx installs in ~/.local/bin as curl (#129)
method() returned 'curl' for anything under ~/.local/bin before the package-manager probes ran. But ~/.local/bin is also the target for npm --prefix ~/.local, pipx, and other managers — so a 'npm i -g' install there was upgraded with the curl script (installing a second copy or clobbering the npm-managed one). Defer the .local/bin heuristic: let the package-manager probes claim it first, and only fall back to 'curl' when none do. (#36)
1 parent c5c2a15 commit 4c53c5d

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

backend/cli/src/installation/index.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ export namespace Installation {
6161
if (process.execPath.includes(path.join(".openscience", "bin"))) return "curl"
6262
// legacy pre-rename curl installs lived under ~/.synsc/bin
6363
if (process.execPath.includes(path.join(".synsc", "bin"))) return "curl"
64-
if (process.execPath.includes(path.join(".local", "bin"))) return "curl"
64+
// ~/.local/bin is ALSO npm's target with `--prefix ~/.local`, pipx, and many
65+
// package managers — so it's ambiguous. Defer it: let the package-manager
66+
// probes below claim the install first, and only fall back to "curl" for
67+
// .local/bin when none of them do (see after the loop). Otherwise a
68+
// `npm i -g` into ~/.local was upgraded with the curl script.
69+
const inLocalBin = process.execPath.includes(path.join(".local", "bin"))
6570
const exec = process.execPath.toLowerCase()
6671

6772
const checks = [
@@ -114,6 +119,10 @@ export namespace Installation {
114119
}
115120
}
116121

122+
// No package manager claimed it — now honor the ambiguous ~/.local/bin as a
123+
// curl install (the curl installer's default target).
124+
if (inLocalBin) return "curl"
125+
117126
return "unknown"
118127
}
119128

0 commit comments

Comments
 (0)