go-openvpn icon indicating copy to clipboard operation
go-openvpn copied to clipboard

Proxy exit codes then CI tools runs subcommands

Open Waldz opened this issue 7 years ago • 5 comments

See ci/commands/utils.go -> MustRunCommand() This command should proxy all data from runned command:

  • output
  • error output
  • exit code https://kev.inburke.com/kevin/proxying-to-a-subcommand-with-go/

Waldz avatar Sep 24 '18 12:09 Waldz

Good example then exit code is not propagated is:

go run ci/main.go test

2018/09/24 15:22:23 exit status 2
exit status 1

Waldz avatar Sep 24 '18 12:09 Waldz

There might be an issue with os.Exit() in golang in general. All it does is print the exit status, but the return code you're getting is always 1.

Here's an example program:

package main

import (
	"os"
)

func main() {
	os.Exit(55)
}

Running it you get the following result: screen shot 2018-09-26 at 11 28 11 am

So if the goal is to exit with the same status code - it might not be possible.

vkuznecovas avatar Sep 26 '18 08:09 vkuznecovas

Looks like that only go run return exit 1: https://github.com/golang/go/issues/13440

If you building it and starting binary everything is fine: image

soffokl avatar Sep 26 '18 10:09 soffokl

sorry for this huge screenshot 😕

soffokl avatar Sep 26 '18 10:09 soffokl

Did Mage solve this problem of proxying output? If so, lets close issue

Waldz avatar Oct 24 '18 09:10 Waldz