diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-14 08:37:19 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-05-14 08:37:19 +0200 |
commit | 0887b0548b8079c80743d92b8b6150ebf103b4be (patch) | |
tree | 3a0724832da09303ce9d540e1b6a1c26e3b28582 /shell-completion | |
parent | 886eaf052d72ddee375ee1f27bfe01f755882e33 (diff) | |
download | systemd-0887b0548b8079c80743d92b8b6150ebf103b4be.tar.gz |
bash-completion: redirect introspection errors to null
If completion is attempted on an invalid path, busctl might respond with an error.
This shouldn't be seen, introspection is supposed to just fail silently.
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/busctl | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl index c357c25bc3..1ac8ac7eca 100644 --- a/shell-completion/bash/busctl +++ b/shell-completion/bash/busctl @@ -28,20 +28,23 @@ __contains_word () { __get_machines() { local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; + machinectl list --no-legend --no-pager 2>/dev/null | + { while read a b; do echo " $a"; done; }; } __get_busnames() { local mode=$1 local a b - busctl $mode list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; + busctl $mode list --no-legend --no-pager 2>/dev/null | + { while read a b; do echo " $a"; done; }; } __get_objects() { local mode=$1 local busname=$2 local a b - busctl $mode tree --list --no-legend --no-pager $busname | { while read a b; do echo " $a"; done; }; + busctl $mode tree --list --no-legend --no-pager $busname 2>/dev/null | + { while read a b; do echo " $a"; done; }; } __get_interfaces() { @@ -49,7 +52,8 @@ __get_interfaces() { local busname=$2 local path=$3 local a b c - busctl $mode introspect --list --no-legend --no-pager $busname $path | { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }; + busctl $mode introspect --list --no-legend --no-pager $busname $path 2>/dev/null | + { while read a b c; do [[ "$b" == "interface" ]] && echo " $a"; done; }; } __get_members() { @@ -60,7 +64,9 @@ __get_members() { local type=$5 local flags=$6 local a b c d e - busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }; + busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null | + sed -e 's/^\.//' | + { while read a b c d e; do [[ "$b" == "$type" && ( -z $flags || "$e" == "$flags" ) ]] && echo " $a"; done; }; } __get_signature() { @@ -70,7 +76,8 @@ __get_signature() { local interface=$4 local member=$5 local a b c d - busctl $mode introspect --list --no-legend --no-pager $busname $path $interface | sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }; + busctl $mode introspect --list --no-legend --no-pager $busname $path $interface 2>/dev/null | + sed -e 's/^\.//' | { while read a b c d; do [[ "$a" == "$member" && "$c" != '-' ]] && echo " \"$c\""; done; }; } _busctl() { |