Skip to content

Replace 'which' calls with 'command -v'

Fredrik Wieczerkowski requested to merge replace-which into master

In an effort to make PAKCS compatible with more operating systems, e.g. Windows, this PR replaces which with command -v. This both avoids spawning a process to check for the path of executables and subtle inconsistencies in how failures are treated (see this Stackoverflow post for further rationale).

A specific example of where the previous/current implementation caused trouble: While most which implementations (e.g. on Linux/macOS) will avoid output when the executable could not be found and no tty is attached, which on MinGW/Windows won't and thus assign the error text as if it were the path to various variables:

which: no <executable> in (<user PATH>)

Merge request reports