aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/go/script_test.go
diff options
context:
space:
mode:
authorManlio Perillo <manlio.perillo@gmail.com>2021-05-13 16:08:59 +0200
committerBryan C. Mills <bcmills@google.com>2021-05-14 15:35:28 +0000
commita938e529861215d9721f5e2590d5166bfbf2d271 (patch)
tree34d79cc79ecd77effc306f0a1cf833027e956cb2 /src/cmd/go/script_test.go
parentd137b745398e8313c0f086d4d044751295be6163 (diff)
downloadgo-a938e529861215d9721f5e2590d5166bfbf2d271.tar.gz
go-a938e529861215d9721f5e2590d5166bfbf2d271.zip
cmd/go: fix a portability issue in the cd script command
Currently all script tests use the UNIX path separator with the cd command, causing the PWD environment variable to have the incorrect path separator on Windows. Call filepath.FromSlash on the cd command argument. Update the testdata/script/README to document that the cd argument must use slashes. Add a regression test. To reproduce this issue, a test must use the cd command followed by a stdout or stderr command containing the pattern $PWD. Change-Id: Ib2dc5f185cc2476451402787996d14df91f7dddb Reviewed-on: https://go-review.googlesource.com/c/go/+/319311 Reviewed-by: Jay Conrod <jayconrod@google.com> Reviewed-by: Bryan C. Mills <bcmills@google.com> Trust: Jay Conrod <jayconrod@google.com> Run-TryBot: Jay Conrod <jayconrod@google.com> TryBot-Result: Go Bot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/script_test.go')
-rw-r--r--src/cmd/go/script_test.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cmd/go/script_test.go b/src/cmd/go/script_test.go
index 327eaff445..639e907db0 100644
--- a/src/cmd/go/script_test.go
+++ b/src/cmd/go/script_test.go
@@ -517,7 +517,7 @@ func (ts *testScript) cmdCd(want simpleStatus, args []string) {
ts.fatalf("usage: cd dir")
}
- dir := args[0]
+ dir := filepath.FromSlash(args[0])
if !filepath.IsAbs(dir) {
dir = filepath.Join(ts.cd, dir)
}