Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit d51414c

Browse files
authored
Fix macos rustup stdout logic where different to linux (#149)
1 parent cfa40f5 commit d51414c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/index.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,10 @@ function rustupRun(toolchain, command, opts={}) {
8282
}
8383

8484
async function rustupDefaultToolchain() {
85+
// linux: "stable-x86_64-unknown-linux-gnu (default)"
86+
// mac: "stable (default)"
8587
let { stdout } = await exec("rustup default")
86-
return stdout.split("-")[0].trim()
88+
return stdout.split("-")[0].trim().split(" ")[0]
8789
}
8890

8991
async function hasCommand(rustCommand) {
@@ -100,13 +102,13 @@ async function rustupOverrides() {
100102
let { stdout } = await exec("rustup override list")
101103
return stdout.split(/[\r\n]+/g)
102104
.map(line => {
103-
let lastSpace = line.lastIndexOf(' ')
105+
let lastSpace = line.trimEnd().lastIndexOf(' ')
104106
return {
105107
path: line.slice(0, lastSpace).trim(),
106108
toolchain: line.slice(lastSpace).trim()
107109
}
108110
})
109-
.filter(({ path, toolchain }) => path && toolchain)
111+
.filter(({ path, toolchain }) => path && toolchain && path !== 'no')
110112
}
111113

112114
/** @return {?string} developer override of the command to start a Rls instance */

0 commit comments

Comments
 (0)