// FindConmon iterates over (*Config).ConmonPath and returns the path
// to first (version) matching conmon binary. If non is found, we try
// to do a path lookup of "conmon".
FindConmon iterates over (*Config).ConmonPath and returns the path
to first (version) matching conmon binary. If non is found, we try
to do a path lookup of "conmon".
// FindConmon iterates over ( * Config ) . ConmonPath and returns the path // to first ( version ) matching conmon binary . If non is found we try // to do a path lookup of " conmon " .
func (c *Config) FindConmon() (string, error) {
	foundOutdatedConmon := false
	for _, path := range c.Engine.ConmonPath {
		stat, err := os.Stat(path)
		if err != nil {
			continue
		}
		if stat.IsDir() {
			continue
		}
		if err := probeConmon(path); err != nil {
			logrus.Warnf("Conmon at %s invalid: %v", path, err)
			foundOutdatedConmon = true
			continue
		}
		logrus.Debugf("Using conmon: %q", path)
		return path, nil
	}
	if path, err := exec.LookPath("conmon"); err == nil {
		if err := probeConmon(path); err != nil {
			logrus.Warnf("Conmon at %s is invalid: %v", path, err)
			foundOutdatedConmon = true
		} else {
			logrus.Debugf("Using conmon from $PATH: %q", path)
			return path, nil
		}
	}
	if foundOutdatedConmon {
		return "", errors.Wrapf(ErrConmonOutdated,
			"please update to v%d.%d.%d or later",
			_conmonMinMajorVersion, _conmonMinMinorVersion, _conmonMinPatchVersion)
	}
	return "", errors.Wrapf(ErrInvalidArg,
		"could not find a working conmon binary (configured options: %v)",
		c.Engine.ConmonPath)
}
func ( c * Config ) FindConmon ( ) ( string , error ) { foundOutdatedConmon := false for _ , path := range c . Engine . ConmonPath { stat , err := os . Stat ( path ) if err != nil { continue } if stat . IsDir ( ) { continue } if err := probeConmon ( path ) ; err != nil { logrus . Warnf ( " " , path , err ) foundOutdatedConmon = true continue } logrus . Debugf ( " " , path ) return path , nil } if path , err := exec . LookPath ( " " ) ; err == nil { if err := probeConmon ( path ) ; err != nil { logrus . Warnf ( " " , path , err ) foundOutdatedConmon = true } else { logrus . Debugf ( " " , path ) return path , nil } } if foundOutdatedConmon { return " " , errors . Wrapf ( ErrConmonOutdated , " " , _conmonMinMajorVersion , _conmonMinMinorVersion , _conmonMinPatchVersion ) } return " " , errors . Wrapf ( ErrInvalidArg , " " , c . Engine . ConmonPath ) }
FindConmon iterates over (*Config).ConmonPath and returns the path
to first (version) matching conmon binary.
FindConmon iterates over ( * Config ) . ConmonPath and returns the path to first ( version ) matching conmon binary .
// Search the $PATH as last fallback