func Run(args []string) error {
	cmd.RunCosmovisorCommands(args)

	cfg, err := cosmovisor.GetConfigFromEnv()
	if err != nil {
		return err
	}
	launcher, err := cosmovisor.NewLauncher(cfg)
	if err != nil {
		return err
	}

	doUpgrade, err := launcher.Run(args, os.Stdout, os.Stderr)
	// if RestartAfterUpgrade, we launch after a successful upgrade (only condition LaunchProcess returns nil)
	for cfg.RestartAfterUpgrade && err == nil && doUpgrade {
		fmt.Println("[cosmovisor] upgrade detected, relaunching the app ", cfg.Name)
		doUpgrade, err = launcher.Run(args, os.Stdout, os.Stderr)
	}
	if doUpgrade && err == nil {
		fmt.Println("[cosmovisor] upgrade detected, DAEMON_RESTART_AFTER_UPGRADE is off. Verify new upgrade and start cosmovisor again.")
	}

	return err
}
// Run is the main loop, but returns an error
Run is the main loop, but returns an error
// Run is the main loop but returns an error
func Run(args []string) error {
	cmd.RunCosmovisorCommands(args)
	cfg, err := cosmovisor.GetConfigFromEnv()
	if err != nil {
		return err
	}
	launcher, err := cosmovisor.NewLauncher(cfg)
	if err != nil {
		return err
	}
	doUpgrade, err := launcher.Run(args, os.Stdout, os.Stderr)
	for cfg.RestartAfterUpgrade && err == nil && doUpgrade {
		fmt.Println("[cosmovisor] upgrade detected, relaunching the app ", cfg.Name)
		doUpgrade, err = launcher.Run(args, os.Stdout, os.Stderr)
	}
	if doUpgrade && err == nil {
		fmt.Println("[cosmovisor] upgrade detected, DAEMON_RESTART_AFTER_UPGRADE is off. Verify new upgrade and start cosmovisor again.")
	}
	return err
}
func Run ( args [ ] string ) error { cmd . RunCosmovisorCommands ( args ) cfg , err := cosmovisor . GetConfigFromEnv ( ) if err != nil { return err } launcher , err := cosmovisor . NewLauncher ( cfg ) if err != nil { return err } doUpgrade , err := launcher . Run ( args , os . Stdout , os . Stderr ) for cfg . RestartAfterUpgrade && err == nil && doUpgrade { fmt . Println ( " " , cfg . Name ) doUpgrade , err = launcher . Run ( args , os . Stdout , os . Stderr ) } if doUpgrade && err == nil { fmt . Println ( " " ) } return err }
Run is the main loop, but returns an error
Run is the main loop but returns an error
// if RestartAfterUpgrade, we launch after a successful upgrade (only condition LaunchProcess returns nil)