mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Detect GNU make via "--version"
Turns out that `make -pn` actually takes a while - about 300ms on fish's makefile. That's quite a bit of time just to throw away the output and use the exit code. So we just check for "GNU" in the version string. It would be nice to just _do_ the completion and fall back on the BSD-style if it doesn't work, but that is tricky to do with the pipe to `awk` - the awk expression actually does not fail if `make` does not print output. And I don't know enough about awk to change that.
This commit is contained in:
parent
9929acd9d8
commit
a4f55d95d4
1 changed files with 1 additions and 1 deletions
|
@ -17,7 +17,7 @@ function __fish_print_make_targets --argument-names directory file
|
||||||
end
|
end
|
||||||
|
|
||||||
set -l bsd_make
|
set -l bsd_make
|
||||||
if make -C $directory -pn >/dev/null 2>/dev/null
|
if make --version 2>/dev/null | string match -q 'GNU*'
|
||||||
set bsd_make 0
|
set bsd_make 0
|
||||||
else
|
else
|
||||||
set bsd_make 1
|
set bsd_make 1
|
||||||
|
|
Loading…
Reference in a new issue