1 | #!/bin/sh
|
2 | argv0=$(echo "$0" | sed -e 's,\\,/,g')
|
3 | basedir=$(dirname "$(readlink "$0" || echo "$argv0")")
|
4 |
|
5 | case "$(uname -s)" in
|
6 | Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;
|
7 | *CYGWIN*) basedir=`cygpath -w "$basedir"`;;
|
8 | *MSYS*) basedir=`cygpath -w "$basedir"`;;
|
9 | esac
|
10 |
|
11 | command_exists() {
|
12 | command -v "$1" >/dev/null 2>&1;
|
13 | }
|
14 |
|
15 | if command_exists node; then
|
16 | if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then
|
17 | winpty node "$basedir/yarn.js" "$@"
|
18 | else
|
19 | exec node "$basedir/yarn.js" "$@"
|
20 | fi
|
21 | ret=$?
|
22 | # Debian and Ubuntu use "nodejs" as the name of the binary, not "node", so we
|
23 | # search for that too. See:
|
24 | # https://lists.debian.org/debian-devel-announce/2012/07/msg00002.html
|
25 | # https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=614907
|
26 | elif command_exists nodejs; then
|
27 | exec nodejs "$basedir/yarn.js" "$@"
|
28 | ret=$?
|
29 | else
|
30 | >&2 echo 'Yarn requires Node.js 4.0 or higher to be installed.'
|
31 | ret=1
|
32 | fi
|
33 |
|
34 | exit $ret
|