From: Nicolas Boisselier Date: Thu, 5 Apr 2018 03:07:15 +0000 (+0100) Subject: etc/profile.d/functions X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=995ef08f293f3313ffb4bc275774cbed2159b3e2;p=nb.git etc/profile.d/functions --- diff --git a/etc/profile.d/functions b/etc/profile.d/functions index 1e560444..46fbff73 100644 --- a/etc/profile.d/functions +++ b/etc/profile.d/functions @@ -115,8 +115,9 @@ nb_repos_grep() { # NB 21.10.17 } timeout() { - if which timeout 1>/dev/null; then - timeout -- $@ + local p + if p=`which timeout 2>/dev/null`; then + $p $@ else perl -e 'BEGIN{$|=1}; $SIG{ALRM}=sub{exit 1}; alarm(shift @ARGV); system join(" ",@ARGV)' -- $@ fi