From 69f1fed52edc02cc6106ea37568390229e4c796c Mon Sep 17 00:00:00 2001 From: JulioJu <11527844+JulioJu@users.noreply.github.com> Date: Thu, 24 Sep 2020 19:38:54 +0200 Subject: [PATCH] fix(windows) #5349 node and yarn can't be launch on Windows into mingw64 As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm --- bin/yarn | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/yarn b/bin/yarn index 35ad5177ff..6364d28abe 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" = 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