On some systems the which
command can emit messages into stderr. For example, for debianutils 5.5-1
package in Debian Sid:
0# which cat
1/usr/bin/which: this version of `which' is deprecated; use `command -v' in scripts instead.
2/bin/cat
Although such messages are harmless, they could distract developers needlessly (see bitcoin/bitcoin#24056).
Fixes bitcoin/bitcoin#24056.