diff options
author | Bryan C. Mills <bcmills@google.com> | 2022-07-08 10:02:14 -0400 |
---|---|---|
committer | Bryan Mills <bcmills@google.com> | 2022-07-08 18:51:33 +0000 |
commit | 5c1a13e7a47bc47c07057c0acf626e3fafe064c9 (patch) | |
tree | 09094b255d871b6cb72d3fc5d61b385f130b9058 /src/cmd/go/testdata/script/README | |
parent | 180bcad33dcd3d59443fe8eda5ae7556b1b2945b (diff) | |
download | go-5c1a13e7a47bc47c07057c0acf626e3fafe064c9.tar.gz go-5c1a13e7a47bc47c07057c0acf626e3fafe064c9.zip |
cmd/go: avoid setting variables for '/' and ':' in TestScript subprocess environments
Also simplify platform-dependent handling of the PATH variable,
to make it more like the existing platform-dependent handling for
HOME and TMPDIR.
Fixes #53671.
Change-Id: Ica2665d3f61988c66fb6982b9feb61ca48eced79
Reviewed-on: https://go-review.googlesource.com/c/go/+/416554
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Bryan Mills <bcmills@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Diffstat (limited to 'src/cmd/go/testdata/script/README')
-rw-r--r-- | src/cmd/go/testdata/script/README | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/cmd/go/testdata/script/README b/src/cmd/go/testdata/script/README index c575bff1a5..e52917684f 100644 --- a/src/cmd/go/testdata/script/README +++ b/src/cmd/go/testdata/script/README @@ -41,12 +41,19 @@ Scripts also have access to these other environment variables: GODEBUG=<actual GODEBUG> devnull=<value of os.DevNull> goversion=<current Go version; for example, 1.12> - :=<OS-specific path list separator> -The scripts' supporting files are unpacked relative to $GOPATH/src (aka $WORK/gopath/src) -and then the script begins execution in that directory as well. Thus the example above runs -in $WORK/gopath/src with GOPATH=$WORK/gopath and $WORK/gopath/src/hello.go -containing the listed contents. +On Plan 9, the variables $path and $home are set instead of $PATH and $HOME. +On Windows, the variables $USERPROFILE and $TMP are set instead of +$HOME and $TMPDIR. + +In addition, variables named ':' and '/' are expanded within script arguments +(expanding to the value of os.PathListSeparator and os.PathSeparator +respectively) but are not inherited in subprocess environments. + +The scripts' supporting files are unpacked relative to $GOPATH/src +(aka $WORK/gopath/src) and then the script begins execution in that directory as +well. Thus the example above runs in $WORK/gopath/src with GOPATH=$WORK/gopath +and $WORK/gopath/src/hello.go containing the listed contents. The lines at the top of the script are a sequence of commands to be executed by a tiny script engine in ../../script_test.go (not the system shell). |