Open
Conversation
Less is called with a filename, and if we basename CMD of less we get a basename of a filename, not a less executable. I think it's just a type that basename was piped to cut, CMD should be cut'ed before processed by basename. As parent_executable is only used by batpipe, we can just cut CMD and extract program name.
|
@ebugusey cheers for this! |
markrustad
added a commit
to markrustad/bat-extras
that referenced
this pull request
Jan 26, 2026
Fix batpipe failing to detect when running inside `less` on modern Linux systems with procps-ng. The issue was that `parent_executable()` returned the full command line (e.g., "less /etc/passwd ") instead of just the program name. When `basename` operated on this, it returned "passwd" instead of "less", causing batpipe to disable color output. Changes: - Move `cut -d' ' -f1` into `parent_executable()` to extract just the program name before returning - Remove now-redundant `cut` calls in batpipe.sh - Fix gawk 5.x compatibility: change `printf $i" "` to `printf "%s ", $i` (GNU Awk 5.x requires format strings for printf) Fixes eth-p#142 Incorporates fix from eth-p#96 with additional gawk compatibility fix.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Less is called with a filename, and if we basename CMD of less we get a basename of a filename, not a less executable. I think it's just a type that basename was piped to cut, CMD should be cut'ed before processed by basename.
As parent_executable is only used by batpipe, we can just cut CMD and extract program name.