From e62ed3a4d3353ac3350a02eae6a4b3bb3d5460c6 Mon Sep 17 00:00:00 2001 From: Nulo Date: Sun, 29 Jan 2023 12:58:06 -0300 Subject: [PATCH] =?UTF-8?q?gitea-ci:=20printear=20c=C3=B3digo=20de=20error?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gitea-ci/webhook.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gitea-ci/webhook.go b/gitea-ci/webhook.go index 4ba4d09..0dde14c 100644 --- a/gitea-ci/webhook.go +++ b/gitea-ci/webhook.go @@ -5,6 +5,8 @@ import ( "crypto/sha256" "encoding/hex" "encoding/json" + "errors" + "fmt" "io" "log" "net/http" @@ -219,6 +221,12 @@ func (h webhook) ServeHTTP(w http.ResponseWriter, req *http.Request) { if err != nil { log.Println("runner.Run", err) state = "failure" + + if unwrapped := errors.Unwrap(err); unwrapped != nil { + if ee, ok := err.(*exec.ExitError); ok { + fmt.Fprintf(run, "\n######### Failed with error code %d", ee.ProcessState.ExitCode()) + } + } } err = h.gitea.CreateCommitStatus(hook.Repository.FullName, hook.AfterCommit, gitea.CommitStatus{ Context: "repro-run",