From: Russ Cox Date: Fri, 19 Feb 2021 10:29:51 +0000 (-0500) Subject: os: fix hex exit code print on 32-bit windows X-Git-Tag: go1.17beta1~1478 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=01eb70e3dd4d7bf00ee915841e6b3c56fc94fe44;p=gostls13.git os: fix hex exit code print on 32-bit windows We want to print hex exit codes for the large values, but on 32-bit Windows the large values are negative. Change-Id: I0e350b128414a9468c93eddc62d660f552c1ee05 Reviewed-on: https://go-review.googlesource.com/c/go/+/294070 Trust: Russ Cox Reviewed-by: Cherry Zhang --- diff --git a/src/os/exec_posix.go b/src/os/exec_posix.go index 39f11c7ec1..8aa1e5e499 100644 --- a/src/os/exec_posix.go +++ b/src/os/exec_posix.go @@ -103,7 +103,7 @@ func (p *ProcessState) String() string { switch { case status.Exited(): code := status.ExitStatus() - if runtime.GOOS == "windows" && code >= 1<<16 { // windows uses large hex numbers + if runtime.GOOS == "windows" && uint(code) >= 1<<16 { // windows uses large hex numbers res = "exit status " + uitox(uint(code)) } else { // unix systems use small decimal integers res = "exit status " + itoa(code) // unix