Skip to content

Commit

Permalink
_known_hosts_real: check that ruptime is present before calling (#390)
Browse files Browse the repository at this point in the history
Avoids calling command_not_found_handle which might take considerable
time.
  • Loading branch information
Self-Perfection authored Feb 24, 2020
1 parent bd3eba8 commit 6217345
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -1685,9 +1685,11 @@ _known_hosts_real()
fi

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

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

0 comments on commit 6217345

Please sign in to comment.