wait-for-it icon indicating copy to clipboard operation
wait-for-it copied to clipboard

timeout command not on macOS

Open zam6ak opened this issue 4 years ago • 8 comments

Seems like timeout is not available on macOS

wait-for-it.sh  www.google.com:443 --timeout=10 -- echo "its up"
readlink: illegal option -- f
usage: readlink [-n] [file ...]
./scripts/wait-for-it.sh: line 58: timeout: command not found
wait-for-it.sh: timeout occurred after waiting 10 seconds for www.google.com:443
its up

zam6ak avatar May 04 '21 21:05 zam6ak

brew install coreutils
alias timeout=gtimeout

🎉

twistezo avatar Jul 22 '21 14:07 twistezo

@twistezo This doesn't really solve the issue, as wait-for-it is supposed to be a standalone executable

deiga avatar Jul 23 '21 19:07 deiga

@deiga wait-for-it is a bash script, so it depends on the packages you have installed. If you're looking for a standalone executable, you can check out wait-for-it - a binary executable built in golang

roerohan avatar Sep 26 '21 10:09 roerohan

@roerohan Sure, it's a bash script, but are any of the packages it uses not system defaults?

deiga avatar Sep 28 '21 17:09 deiga

@deiga I'm not sure about how it works on mac, I'm hoping someone else can answer. Also it's been really long so I'm assuming you might have figured it out 😛

roerohan avatar Feb 19 '22 20:02 roerohan

same question. it's not working on mac

hujesse83 avatar Mar 14 '22 02:03 hujesse83

We do our development on Mac and deploy to Linux. I need to be able to run locally before I commit, so Linux only is a problem. Is there an alternative solution?

Ezward avatar Jun 15 '22 21:06 Ezward

I added this to the beginning of the script. Works on mac for local dev and linux for ci

if [[ $OSTYPE == 'darwin'* ]]; then
  if ! command -v gtimeout &> /dev/null
  then
      echo "missing gtimeout (`brew install coreutils`)"
      exit
  fi
  alias timeout=gtimeout
fi

ougarcia avatar Jul 13 '23 16:07 ougarcia