]> Cypherpunks repositories - gostls13.git/commitdiff
os: fix hex exit code print on 32-bit windows
authorRuss Cox <rsc@golang.org>
Fri, 19 Feb 2021 10:29:51 +0000 (05:29 -0500)
committerRuss Cox <rsc@golang.org>
Fri, 19 Feb 2021 15:30:59 +0000 (15:30 +0000)
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 <rsc@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/os/exec_posix.go

index 39f11c7ec1b7be613fd9ae5b77822183df20f607..8aa1e5e49996fdd1097121341db4a234c29d28ef 100644 (file)
@@ -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