Skip to content

Commit 83f78d2

Browse files
author
Richard Alpe
committed
tipc: suppress tipc error messages
Suppress error messages if the TIPC module isn't loaded and the user tries to complete TIPC specific entries, such as links or bearers. Fixes #59
1 parent 54ca5fe commit 83f78d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

completions/tipc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ _tipc_bearer() {
4040
elif [[ $cword -eq $optind+3 ]]; then
4141
case "$media" in
4242
"udp")
43-
local names=$(tipc bearer list | awk -F: '/^udp:/ {print $2}')
43+
local names=$(tipc bearer list 2>/dev/null | awk -F: '/^udp:/ {print $2}')
4444
COMPREPLY=( $( compgen -W '$names' -- $cur) )
4545
;;
4646
"eth")
@@ -63,7 +63,8 @@ _tipc_link() {
6363
COMPREPLY=( $( compgen -W 'link' -- $cur) )
6464
elif [[ $cword -eq $optind+1 ]]; then
6565
# awk drops link state and last trailing :
66-
local links=$(tipc link list | awk '{print substr($1, 0, length($1)-1)}')
66+
local links=$(tipc link list 2>/dev/null | \
67+
awk '{print substr($1, 0, length($1)-1)}')
6768
if [[ $filter == "peers" ]]; then
6869
links=$(command sed '/broadcast-link/d' <<<"$links")
6970
fi

0 commit comments

Comments
 (0)