1
0
mirror of https://github.com/golang/go synced 2024-11-22 19:54:39 -07:00
Change-Id: Iaaa821da8451bab91e81ea457b3ea6f32ff91823
This commit is contained in:
qiulaidongfeng 2024-06-01 08:57:56 +08:00
parent b7431d6eeb
commit dc3169f235

View File

@ -440,7 +440,7 @@ func Command(name string, arg ...string) *Cmd {
// cmd.Dir may be set after we return from this function and that may cause // cmd.Dir may be set after we return from this function and that may cause
// the command to resolve to a different extension. // the command to resolve to a different extension.
lp, err := lookExtensions(name, "") lp, err := lookExtensions(name, "")
cmd.cacheLookExtensions = lp cmd.cachedLookExtensions = lp
if err != nil { if err != nil {
cmd.Err = err cmd.Err = err
} }
@ -642,10 +642,10 @@ func (c *Cmd) Start() error {
return c.Err return c.Err
} }
lp := c.Path lp := c.Path
if c.cacheLookExtensions != "" { if c.cachedLookExtensions != "" {
lp = c.cacheLookExtensions lp = c.cachedLookExtensions
} }
if runtime.GOOS == "windows" && c.cacheLookExtensions == "" { if runtime.GOOS == "windows" && c.cachedLookExtensions == "" {
// If c.Path is relative, we had to wait until now // If c.Path is relative, we had to wait until now
// to resolve it in case c.Dir was changed. // to resolve it in case c.Dir was changed.
// (If it is absolute, we already resolved its extension in Command // (If it is absolute, we already resolved its extension in Command