From 4fe7ba832e7ed4b8af4458e50cf14d324221c781 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 with Git Bash As npm workaround, launch node.exe See also https://github.com/npm/cli/blob/bd2721dbc3de13a5ba889eba50644475d80f6948/bin/npm --- bin/yarn | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/yarn b/bin/yarn index 35ad5177ff..b50d24263b 100755 --- a/bin/yarn +++ b/bin/yarn @@ -2,18 +2,24 @@ argv0=$(echo "$0" | sed -e 's,\\,/,g') basedir=$(dirname "$(readlink "$0" || echo "$argv0")") +is_mingw64=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"`;; + *MINGW*) basedir=`cygpath -w "$basedir"` ; is_mingw64=1;; esac command_exists() { command -v "$1" >/dev/null 2>&1; } -if command_exists node; then +if [ "$YARN_FORCE_WINPTY" != 1 ] && [ "$is_mingw64" = 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