Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix
command -v
compatibility with dash shell
Fix the `command -v` exit status handling to account for dash being `/bin/sh` (this is e.g. the default on Debian). Unlike bash, dash exits with status 127 if the requested program does not exist -- and testinfra wrongly interpreted that as `command` being unavailable. Instead of attempting to use `command -v` and `which` in order, peform an additional (cached) `command -v command` invocation to determine whether `command` is available. Furthermore, assume that `command -v` can return any non-zero status for command not existing, per POSIX. This fixes exists() and find_command() raising an exception on systems using dash as `/bin/sh` and lacking `which(1)`. Fixes #668
- Loading branch information