diff --git a/bin/yarn b/bin/yarn index 35ad5177ff..0343e1c9e8 100755 --- a/bin/yarn +++ b/bin/yarn @@ -2,18 +2,23 @@ argv0=$(echo "$0" | sed -e 's,\\,/,g') basedir=$(dirname "$(readlink "$0" || echo "$argv0")") +is_mingw64_or_cygwin=0 + case "$(uname -s)" in Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";; Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");; - *CYGWIN*) basedir=`cygpath -w "$basedir"`;; - *MSYS*) basedir=`cygpath -w "$basedir"`;; + *CYGWIN*) basedir=`cygpath -w "$basedir"` ; is_mingw64_or_cygwin=1 ;; + *MSYS*) basedir=`cygpath -w "$basedir"` ; is_mingw64_or_cygwin=1 ;; esac command_exists() { command -v "$1" >/dev/null 2>&1; } -if command_exists node; then +if [ "$YARN_FORCE_WINPTY" != 1 ] && [ "$is_mingw64_or_cygwin" -eq 1 ] && command_exists "node.exe" ; then + exec node.exe "$basedir/yarn.js" "$@" + ret=$? +elif command_exists node; then if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then winpty node "$basedir/yarn.js" "$@" else