Skip to content

Commit 9f52c69

Browse files
committed
_services: Try systemctl list-unit-files if systemctl list-units fails
This is mostly for CI/test purposes, where systemctl list-units may refuse to cooperate because the test container isn't running with systemd as PID 1. Falling back to list-unit-files gives us at least some completions to work with.
1 parent 03442fa commit 9f52c69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bash_completion

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,8 @@ _services()
11451145
$( printf '%s\n' ${sysvdirs[0]}/!($_backup_glob|functions|README) ) )
11461146
$reset
11471147

1148-
COMPREPLY+=( $( systemctl list-units --full --all 2>/dev/null | \
1148+
COMPREPLY+=( $( { systemctl list-units --full --all || \
1149+
systemctl list-unit-files; } 2>/dev/null | \
11491150
awk '$1 ~ /\.service$/ { sub("\\.service$", "", $1); print $1 }' ) )
11501151

11511152
if [[ -x /sbin/upstart-udev-bridge ]]; then

0 commit comments

Comments
 (0)