mirror of
https://github.com/systemd/systemd.git
synced 2025-01-23 02:04:32 +03:00
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.
This commit is contained in:
parent
886eaf052d
commit
0887b0548b
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user