...

Source file src/gotest.tools/v3/icmd/exitcode.go

Documentation: gotest.tools/v3/icmd

     1  package icmd
     2  
     3  import (
     4  	"errors"
     5  	"os/exec"
     6  )
     7  
     8  func processExitCode(err error) int {
     9  	if err == nil {
    10  		return 0
    11  	}
    12  
    13  	var exitErr *exec.ExitError
    14  	if errors.As(err, &exitErr) {
    15  		if exitErr.ProcessState == nil {
    16  			return 0
    17  		}
    18  		if code := exitErr.ProcessState.ExitCode(); code != -1 {
    19  			return code
    20  		}
    21  	}
    22  	return 127
    23  }
    24  

View as plain text