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

linux/bin/code.sh: use command -v instead of which #82097

Merged
merged 1 commit into from
Oct 8, 2019
Merged

linux/bin/code.sh: use command -v instead of which #82097

merged 1 commit into from
Oct 8, 2019

Conversation

jplatte
Copy link
Contributor

@jplatte jplatte commented Oct 8, 2019

command is a bash-builtin (see the Bash manual) that is guaranteed to always be present, in contrast to which, which is not required to be available for bash to work.

This dependency on which has recently caused an issue for a small percentage of arch linux users where VSCode wouldn't start anymore, see visual-studio-code-bin on the AUR. By removing the dependency, VSCode becomes a tiny bit more self-contained (unless it's still used somewhere else of course).

Copy link
Member

@Tyriar Tyriar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion 👍

@Tyriar Tyriar added this to the October 2019 milestone Oct 8, 2019
@Tyriar Tyriar merged commit f0faef0 into microsoft:master Oct 8, 2019
@eli-schwartz
Copy link

eli-schwartz commented Oct 13, 2019

More generally, see https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
See also https://mywiki.wooledge.org/BashFAQ/081

command -v is guaranteed to exist in any Bourne-like shell that is compliant with POSIX 2008 (in POSIX 2004 it was an optional component only required on systems with the User Portability option, but then it became required everywhere as of the decade-old 2008 standard). The which program isn't guaranteed to exist anywhere, although Debian's policy document requires it.

Thanks for doing your part to help get us one step closer to a world in which the "which" program is not used. :)

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants