mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 12:02:18 +02:00
Merge pull request #245 from signalapp/jrose/shellcheck-command-v
Use `command -v` instead of `which`, as recommended by Shellcheck
This commit is contained in:
commit
08d6495635
@ -6,21 +6,21 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
check_rust() {
|
||||
if ! which rustup > /dev/null && [[ -d ~/.cargo/bin ]]; then
|
||||
if ! command -v rustup > /dev/null && [[ -d ~/.cargo/bin ]]; then
|
||||
# Try to find rustup in its default per-user install location.
|
||||
# This will be important when running from inside Xcode,
|
||||
# which does not run in a login shell context.
|
||||
PATH=~/.cargo/bin:$PATH
|
||||
fi
|
||||
|
||||
if ! which rustup > /dev/null; then
|
||||
if ! which cargo > /dev/null; then
|
||||
if ! command -v rustup > /dev/null; then
|
||||
if ! command -v cargo > /dev/null; then
|
||||
echo 'error: cargo not found in PATH; do you have Rust installed?' >&2
|
||||
echo 'note: we recommend installing Rust via rustup from https://rustup.rs/' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo 'warning: rustup not found in PATH; using cargo at' "$(which cargo)" >&2
|
||||
echo 'warning: rustup not found in PATH; using cargo at' "$(command -v cargo)" >&2
|
||||
echo 'note: this project uses Rust toolchain' "'$(cat ./rust-toolchain)'" >&2
|
||||
return
|
||||
fi
|
||||
|
@ -29,9 +29,9 @@ END
|
||||
}
|
||||
|
||||
check_cbindgen() {
|
||||
if ! which cbindgen > /dev/null; then
|
||||
if ! command -v cbindgen > /dev/null; then
|
||||
echo 'error: cbindgen not found in PATH' >&2
|
||||
if which cargo > /dev/null; then
|
||||
if command -v cargo > /dev/null; then
|
||||
echo 'note: get it by running' >&2
|
||||
printf "\n\t%s\n\n" "cargo install cbindgen --vers '^0.16'" >&2
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user