HomePhabricator
Diffusion Comm a2524b1cce6a

[Chore] Unbreak rust_pre_commit for UNIX

Description

[Chore] Unbreak rust_pre_commit for UNIX

Summary:
Setting PATH to a directory also unsets how to find commands.
So cargo fmt would just return command not found: cargo.

This uses a different variable other than PATH to reference the directories.

Likely this was overlooked, because it doesn't look like anyone has touched the
rust files since this hook was introduced.

Also: not everyone has a $HOME/.cargo/env, and command -v <command> is the canonical POSIX way to check if a command exists on PATH

Test Plan:

# change something under services/commtest
git add services/commtest
git commit --dry-run # should succeed

Reviewers: abosh, atul, varun

Reviewed By: atul

Subscribers: ashoat, tomek

Differential Revision: https://phab.comm.dev/D5101

Details

Provenance
jonAuthored on Sep 9 2022, 11:59 AM
Reviewer
atul
Differential Revision
D5101: [Chore] Unbreak rust_pre_commit for UNIX
Parents
rCOMMbb49bb232c94: [CMake] Use correct protobuf capitalization
Branches
Unknown
Tags
Unknown