npm / node-which

Like which(1) unix command. Find the first instance of an executable in the PATH.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[FEATURE] command -v is preferable (usually) to which

dankamongmen opened this issue · comments

What / Why

Generally, the POSIX form command -v is preferable to which for the type of things this package does (which is not part of POSIX). Debian has recently removed which from the base distribution (see https://lists.debian.org/debian-devel/2021/09/msg00283.html), and while it was replaced, it now generates the diagnostic:

/usr/bin/which: this version of which is deprecated; use command -v in scripts instead.

Issues include which's failure to canonicalize paths (sometimes)

When

Whenever which is invoked from debianutils, this diagnostic is annoyingly/worryingly generated. Whenever which is invoked, unspecified behavior is risked.

Current Behavior

The package invokes which.

Expected Behavior

The package ought invoke command -v. This might only be available as a builtin, in which case it can be invoked via invoking e.g. /bin/sh -c command -v.

I'm happy to make this change for you if you agree that it ought be made. I do not see any reason to rename the module or change its API.

Sadly, I have the impression that this project is unmaintained. Last bug closed 3 years ago, no commits and PRs fully ignored.

Did you pick something else or went DIY and avoid adding a new dependency?

Correct me if I'm wrong, but this package does not use which. Rather it just imitates its functionality.

Correct me if I'm wrong, but this package does not use which. Rather it just imitates its functionality.

This is correct. This package does not invoke any commands, but is instead the which command's functionality reimplemented using node.js APIs.