Fixes #5066: Use command instead of which in run-inventory to prevent unneeded dependencies