func computeExitCode()

in run.go [174:198]


func computeExitCode(c *ec2macosinit.InitConfig, e int) (exitCode int) {
	// Check if other runs have happened this boot and return data about them
	exceeded, err := c.RetriesExceeded()
	if err != nil {
		c.Log.Errorf("Error while getting retry information: %s", err)
		return 1
	}

	// If the count has exceed the limit, return 0
	if exceeded {
		c.Log.Errorf("Number of fatal retries (%d) exceeded, exiting 0 to avoid infinite runs",
			c.FatalCounts.Count)
		return 0
	}

	c.Log.Infof("Fatal [%d/%d] of this boot", c.FatalCounts.Count, ec2macosinit.PerBootFatalLimit)
	// Increment the counter in the temporary file before returning
	err = c.FatalCounts.IncrementFatalCount()
	if err != nil {
		c.Log.Errorf("Unable to write fatal counts to file: %s", err)
	}

	// Return the requested exit code
	return e
}