Skip to content

Commit 6217345

Browse files
_known_hosts_real: check that ruptime is present before calling (#390)
Avoids calling command_not_found_handle which might take considerable time.
1 parent bd3eba8 commit 6217345

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

bash_completion

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,9 +1685,11 @@ _known_hosts_real()
16851685
fi
16861686

16871687
# Add hosts reported by ruptime.
1688-
COMPREPLY+=( $(compgen -W \
1689-
"$(ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }')" \
1690-
-- "$cur") )
1688+
if type ruptime &>/dev/null; then
1689+
COMPREPLY+=( $(compgen -W \
1690+
"$(ruptime 2>/dev/null | awk '!/^ruptime:/ { print $1 }')" \
1691+
-- "$cur") )
1692+
fi
16911693

16921694
# Add results of normal hostname completion, unless
16931695
# `COMP_KNOWN_HOSTS_WITH_HOSTFILE' is set to an empty value.

0 commit comments

Comments
 (0)