aboutsummaryrefslogtreecommitdiff
path: root/src/os/exec
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/exec')
-rw-r--r--src/os/exec/exec.go7
-rw-r--r--src/os/exec/lp_plan9.go3
-rw-r--r--src/os/exec/lp_unix.go3
-rw-r--r--src/os/exec/lp_windows.go5
4 files changed, 9 insertions, 9 deletions
diff --git a/src/os/exec/exec.go b/src/os/exec/exec.go
index 46b09b9c0c..2f4bdffe9c 100644
--- a/src/os/exec/exec.go
+++ b/src/os/exec/exec.go
@@ -348,6 +348,9 @@ type ctxResult struct {
timer *time.Timer
}
+var execwait = godebug.New("execwait")
+var execerrdot = godebug.New("execerrdot")
+
// Command returns the Cmd struct to execute the named program with
// the given arguments.
//
@@ -376,8 +379,8 @@ func Command(name string, arg ...string) *Cmd {
Args: append([]string{name}, arg...),
}
- if execwait := godebug.Get("execwait"); execwait != "" {
- if execwait == "2" {
+ if v := execwait.Value(); v != "" {
+ if v == "2" {
// Obtain the caller stack. (This is equivalent to runtime/debug.Stack,
// copied to avoid importing the whole package.)
stack := make([]byte, 1024)
diff --git a/src/os/exec/lp_plan9.go b/src/os/exec/lp_plan9.go
index 092684f03a..59538d98a3 100644
--- a/src/os/exec/lp_plan9.go
+++ b/src/os/exec/lp_plan9.go
@@ -6,7 +6,6 @@ package exec
import (
"errors"
- "internal/godebug"
"io/fs"
"os"
"path/filepath"
@@ -54,7 +53,7 @@ func LookPath(file string) (string, error) {
for _, dir := range filepath.SplitList(path) {
path := filepath.Join(dir, file)
if err := findExecutable(path); err == nil {
- if !filepath.IsAbs(path) && godebug.Get("execerrdot") != "0" {
+ if !filepath.IsAbs(path) && execerrdot.Value() != "0" {
return path, &Error{file, ErrDot}
}
return path, nil
diff --git a/src/os/exec/lp_unix.go b/src/os/exec/lp_unix.go
index af68c2f268..2af9b01cf6 100644
--- a/src/os/exec/lp_unix.go
+++ b/src/os/exec/lp_unix.go
@@ -8,7 +8,6 @@ package exec
import (
"errors"
- "internal/godebug"
"internal/syscall/unix"
"io/fs"
"os"
@@ -70,7 +69,7 @@ func LookPath(file string) (string, error) {
}
path := filepath.Join(dir, file)
if err := findExecutable(path); err == nil {
- if !filepath.IsAbs(path) && godebug.Get("execerrdot") != "0" {
+ if !filepath.IsAbs(path) && execerrdot.Value() != "0" {
return path, &Error{file, ErrDot}
}
return path, nil
diff --git a/src/os/exec/lp_windows.go b/src/os/exec/lp_windows.go
index ec45db7459..97bfa58244 100644
--- a/src/os/exec/lp_windows.go
+++ b/src/os/exec/lp_windows.go
@@ -6,7 +6,6 @@ package exec
import (
"errors"
- "internal/godebug"
"io/fs"
"os"
"path/filepath"
@@ -103,7 +102,7 @@ func LookPath(file string) (string, error) {
)
if _, found := syscall.Getenv("NoDefaultCurrentDirectoryInExePath"); !found {
if f, err := findExecutable(filepath.Join(".", file), exts); err == nil {
- if godebug.Get("execerrdot") == "0" {
+ if execerrdot.Value() == "0" {
return f, nil
}
dotf, dotErr = f, &Error{file, ErrDot}
@@ -128,7 +127,7 @@ func LookPath(file string) (string, error) {
}
}
- if !filepath.IsAbs(f) && godebug.Get("execerrdot") != "0" {
+ if !filepath.IsAbs(f) && execerrdot.Value() != "0" {
return f, &Error{file, ErrDot}
}
return f, nil