Commit 6fb2a05a authored by Alex Brainman's avatar Alex Brainman

os: simplify windows Getwd (fixes build)

Current version of Getwd calls Stat that
calls Getwd therefore infinite recursion.

LGTM=minux
R=golang-codereviews, minux
CC=golang-codereviews
https://golang.org/cl/119600043
parent 77a8dcab
......@@ -5,6 +5,7 @@
package os
import (
"runtime"
"sync"
"syscall"
)
......@@ -23,6 +24,10 @@ var useSyscallwd = func(error) bool { return true }
// reached via multiple paths (due to symbolic links),
// Getwd may return any one of them.
func Getwd() (dir string, err error) {
if runtime.GOOS == "windows" {
return syscall.Getwd()
}
// Clumsy but widespread kludge:
// if $PWD is set and matches ".", use it.
dot, err := Stat(".")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment