Skip to content

Commit 4fe7ba8

Browse files
committed
fix(windows) yarnpkg#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
1 parent cbeead6 commit 4fe7ba8

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bin/yarn

+7-1
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,24 @@
22
argv0=$(echo "$0" | sed -e 's,\\,/,g')
33
basedir=$(dirname "$(readlink "$0" || echo "$argv0")")
44

5+
is_mingw64=0
6+
57
case "$(uname -s)" in
68
Darwin) basedir="$( cd "$( dirname "$argv0" )" && pwd )";;
79
Linux) basedir=$(dirname "$(readlink -f "$0" || echo "$argv0")");;
810
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
911
*MSYS*) basedir=`cygpath -w "$basedir"`;;
12+
*MINGW*) basedir=`cygpath -w "$basedir"` ; is_mingw64=1;;
1013
esac
1114

1215
command_exists() {
1316
command -v "$1" >/dev/null 2>&1;
1417
}
1518

16-
if command_exists node; then
19+
if [ "$YARN_FORCE_WINPTY" != 1 ] && [ "$is_mingw64" = 1 ] && command_exists "node.exe" ; then
20+
exec node.exe "$basedir/yarn.js" "$@"
21+
ret=$?
22+
elif command_exists node; then
1723
if [ "$YARN_FORCE_WINPTY" = 1 ] || command_exists winpty && test -t 1; then
1824
winpty node "$basedir/yarn.js" "$@"
1925
else

0 commit comments

Comments
 (0)