Skip to content

v1.0.55: Fix unnecessary calls to less (#56)

Compare
Choose a tag to compare
@anton-b anton-b released this 05 Nov 12:16
· 37 commits to master since this release
da1427c
There was an unnecessarily complex call to `less` to check if it is available on the path.  This actually
invoked `less` without a filename and without a piped input.  Some versions of `less` (e.g. the default on
OS X) allow this, but others (e.g. the version installed by Homebrew) don't.

The call to `less` happened in a class initialization, so every call to `alcli` called `less`, which
printed an error on stdout that said `Missing filename ("less --help" for help)`.  This broke piping to jq.

The fix is to use `shutil.which` to find the path to `less`, if it exists.

Additionally, this fixes a potential bug where the system isn't `"win32"` and `less` isn't on the path.
Previously it would crash trying to invoke `None(help_text)` when printing help text. Now it emits the text
directly.