Skip to content

Commit c779c7d

Browse files
authored
GODRIVER-2264 Fix PATH on Windows to work with Cygwin/Bash shell. (#944)
1 parent 22aa77a commit c779c7d

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.evergreen/config.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,19 @@ functions:
7373
fi
7474
7575
# Set actual PATH. PATH should contain binaries from GOROOT, GOPATH, GCC_PATH and mongodb.
76-
# Adding GOROOT's bin to PATH on Windows requires a cygpath conversion.
7776
export GOROOTBIN="$GOROOT/bin"
77+
export GOPATHBIN="$GOPATH/bin"
7878
if [ "Windows_NT" = "$OS" ]; then
79-
export GOROOTBIN=$(cygpath -m $GOROOTBIN)
79+
# Convert all Windows-style paths (e.g. C:/) to Bash-style Cygwin paths
80+
# (e.g. /cygdrive/c/...) because PATH is interpreted by Bash, which uses ":" as a
81+
# separator so doesn't support Windows-style paths. Other scripts or binaries that
82+
# aren't part of Cygwin still need the environment variables to use Windows-style
83+
# paths, so only convert them when setting PATH. Note that GCC_PATH is already a
84+
# Bash-style Cygwin path for all Windows tasks.
85+
export PATH="$(cygpath $GOROOTBIN):$(cygpath $GOPATHBIN):${GCC_PATH}:$(cygpath $MONGODB_BINARIES):$PATH"
86+
else
87+
export PATH="$GOROOTBIN:$GOPATHBIN:${GCC_PATH}:$MONGODB_BINARIES:$PATH"
8088
fi
81-
export PATH="$GOROOTBIN:$GOPATH/bin:${GCC_PATH}:$MONGODB_BINARIES:$PATH"
8289
8390
# Check Go installation.
8491
go version

0 commit comments

Comments
 (0)