func extractExitCode(err error) int {
	// base case
	if err == nil {
		return 0
	}

	// try to get the exit code
	if exitError, ok := err.(*exec.ExitError); ok {
		ws := exitError.Sys().(syscall.WaitStatus)
		return ws.ExitStatus()
	}

	// This will happen (in OSX) if `name` is not available in $PATH,
	// in this situation, exit code could not be get, and stderr will be
	// empty string very likely, so we use the default fail code, and format err
	// to string and set to stderr
	return defaultFailedCode
}
// extractExitCode from the error passed
extractExitCode from the error passed
// extractExitCode from the error passed
func extractExitCode(err error) int {
	if err == nil {
		return 0
	}
	if exitError, ok := err.(*exec.ExitError); ok {
		ws := exitError.Sys().(syscall.WaitStatus)
		return ws.ExitStatus()
	}
	return defaultFailedCode
}
func extractExitCode ( err error ) int { if err == nil { return 0 } if exitError , ok := err . ( * exec . ExitError ) ; ok { ws := exitError . Sys ( ) . ( syscall . WaitStatus ) return ws . ExitStatus ( ) } return defaultFailedCode }
extractExitCode from the error passed
extractExitCode from the error passed
// base case // try to get the exit code // This will happen (in OSX) if `name` is not available in $PATH, // in this situation, exit code could not be get, and stderr will be // empty string very likely, so we use the default fail code, and format err // to string and set to stderr