mirror of
https://github.com/golang/go
synced 2024-11-13 19:10:22 -07:00
syscall: remove terminating \r and \n from windows error messages
R=rsc, peterGo CC=golang-dev https://golang.org/cl/3095042
This commit is contained in:
parent
e04ef7769e
commit
84713d46f6
@ -161,7 +161,10 @@ func Errstr(errno int) string {
|
|||||||
if err != 0 {
|
if err != 0 {
|
||||||
return "error " + str(errno) + " (FormatMessage failed with err=" + str(err) + ")"
|
return "error " + str(errno) + " (FormatMessage failed with err=" + str(err) + ")"
|
||||||
}
|
}
|
||||||
return string(utf16.Decode(b[0 : n-1]))
|
// trim terminating \r and \n
|
||||||
|
for ; n > 0 && (b[n-1] == '\n' || b[n-1] == '\r'); n-- {
|
||||||
|
}
|
||||||
|
return string(utf16.Decode(b[:n]))
|
||||||
}
|
}
|
||||||
|
|
||||||
func Exit(code int) { ExitProcess(uint32(code)) }
|
func Exit(code int) { ExitProcess(uint32(code)) }
|
||||||
|
Loading…
Reference in New Issue
Block a user