completions: pipe stderr to /dev/null

This fixes weird issues where e.g.

    nix build -L .#<tab>

deletes the current line from the prompt.
This commit is contained in:
Maximilian Bosch 2022-02-04 22:43:16 +01:00
parent 59b6afec07
commit 9d840758a8
No known key found for this signature in database
GPG key ID: 091DBF4D1FC46B8E
2 changed files with 2 additions and 2 deletions

View file

@ -15,7 +15,7 @@ function _complete_nix {
else
COMPREPLY+=("$completion")
fi
done < <(NIX_GET_COMPLETIONS=$cword "${words[@]/#\~/$HOME}")
done < <(NIX_GET_COMPLETIONS=$cword "${words[@]/#\~/$HOME}" 2>/dev/null)
__ltrim_colon_completions "$cur"
}

View file

@ -4,7 +4,7 @@ function _nix() {
local ifs_bk="$IFS"
local input=("${(Q)words[@]}")
IFS=$'\n'
local res=($(NIX_GET_COMPLETIONS=$((CURRENT - 1)) "$input[@]"))
local res=($(NIX_GET_COMPLETIONS=$((CURRENT - 1)) "$input[@]" 2>/dev/null))
IFS="$ifs_bk"
local tpe="${${res[1]}%%> *}"
local -a suggestions