Commit 84713d46 authored by Alex Brainman's avatar Alex Brainman

syscall: remove terminating \r and \n from windows error messages

R=rsc, peterGo
CC=golang-dev
https://golang.org/cl/3095042
parent e04ef776
......@@ -161,7 +161,10 @@ func Errstr(errno int) string {
if err != 0 {
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)) }
......
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