mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
all: use ExitCode() call to get exit code of exited process
This is an addition that landed in Go 1.12 but we couldn't use before because we were supporting Go back until Go 1.11. It simplifies the code around processes a bit.
This commit is contained in:
committed by
Ron Evans
parent
e3aa13c2a6
commit
c60c36f0a8
+1
-5
@@ -16,7 +16,6 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/tinygo-org/tinygo/cgo"
|
||||
"github.com/tinygo-org/tinygo/compileopts"
|
||||
@@ -110,10 +109,7 @@ func Load(config *compileopts.Config, inputPkgs []string, clangHeaders string, t
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
if exitErr, ok := err.(*exec.ExitError); ok {
|
||||
if status, ok := exitErr.Sys().(syscall.WaitStatus); ok {
|
||||
os.Exit(status.ExitStatus())
|
||||
}
|
||||
os.Exit(1)
|
||||
os.Exit(exitErr.ExitCode())
|
||||
}
|
||||
return nil, fmt.Errorf("failed to run `go list`: %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user