Skip to content

Commit 2e0a6f8

Browse files
kolyshkingopherbot
authored andcommitted
os.Getwd: wrap error on windows and plan9
The errors from os are supposed to be wrapped to add some context, but in this particular case a raw syscall error is returned. Change-Id: I1b98dbd7b385c5c1cea79a1b0ec7201ca9bdca40 Reviewed-on: https://go-review.googlesource.com/c/go/+/606657 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Cherry Mui <[email protected]>
1 parent d2b6bdb commit 2e0a6f8

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/os/getwd.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ var getwdCache struct {
2121
// Getwd may return any one of them.
2222
func Getwd() (dir string, err error) {
2323
if runtime.GOOS == "windows" || runtime.GOOS == "plan9" {
24-
return syscall.Getwd()
24+
dir, err = syscall.Getwd()
25+
return dir, NewSyscallError("getwd", err)
2526
}
2627

2728
// Clumsy but widespread kludge:

0 commit comments

Comments
 (0)