Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

executableExists assumes the existance of "which" #327

Closed
expipiplus1 opened this issue Nov 29, 2020 · 6 comments · Fixed by #518
Closed

executableExists assumes the existance of "which" #327

expipiplus1 opened this issue Nov 29, 2020 · 6 comments · Fixed by #518
Labels
type: bug A bug or unintended effect

Comments

@expipiplus1
Copy link
Contributor

If which isn't in the PATH it should probably not fail saying that the queried executable isn't available, very confusing!

@jneira
Copy link
Member

jneira commented Nov 29, 2020

or windows 🤔 It uses where/which

could you link the code if you have it at hand, please?

vscode-haskell/src/utils.ts

Lines 207 to 212 in 518d34f

export function executableExists(exe: string): boolean {
const isWindows = process.platform === 'win32';
const cmd: string = isWindows ? 'where' : 'which';
const out = child_process.spawnSync(cmd, [exe]);
return out.status === 0 || (isWindows && fs.existsSync(exe));
}

@expipiplus1 in which concrete cases is probable to not have it in $PATH?

@jneira jneira added the type: bug A bug or unintended effect label Nov 29, 2020
@expipiplus1
Copy link
Contributor Author

@jneira I bumped into this in a nix build which didn't list pkgs.which as a build input.

@michaelpj
Copy link
Contributor

I also just hit this. In my case I was trying to build a docker devcontainer with HLS and hadn't put which in there. Spent a good couple of hours tearing my hair out about what was wrong with the PATH until I read the extension source! It's a niche case but quite painful when it comes up 😅

@jneira
Copy link
Member

jneira commented Dec 9, 2021

@expipiplus1 @michaelpj hi! i've prepared a fix with #518, could you got the chance of test the pr vsix to check if it fix the issue in your envs?

https://github.com/haskell/vscode-haskell/suites/4605389050/artifacts/124395850

@jneira
Copy link
Member

jneira commented Dec 10, 2021

checked manually in wsl

@expipiplus1
Copy link
Contributor Author

thanks @jneira!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A bug or unintended effect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants