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 @@ ...@@ -5,6 +5,7 @@
package os package os
import ( import (
"runtime"
"sync" "sync"
"syscall" "syscall"
) )
...@@ -23,6 +24,10 @@ var useSyscallwd = func(error) bool { return true } ...@@ -23,6 +24,10 @@ var useSyscallwd = func(error) bool { return true }
// reached via multiple paths (due to symbolic links), // reached via multiple paths (due to symbolic links),
// Getwd may return any one of them. // Getwd may return any one of them.
func Getwd() (dir string, err error) { func Getwd() (dir string, err error) {
if runtime.GOOS == "windows" {
return syscall.Getwd()
}
// Clumsy but widespread kludge: // Clumsy but widespread kludge:
// if $PWD is set and matches ".", use it. // if $PWD is set and matches ".", use it.
dot, err := Stat(".") 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