From 995ef08f293f3313ffb4bc275774cbed2159b3e2 Mon Sep 17 00:00:00 2001 From: Nicolas Boisselier Date: Thu, 5 Apr 2018 04:07:15 +0100 Subject: [PATCH] etc/profile.d/functions --- etc/profile.d/functions | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 -- 2.47.3