func startCmd(mysqld *mysqlctl.Mysqld, subFlags *flag.FlagSet, args []string) { waitTime := subFlags.Duration("wait_time", mysqlctl.MysqlWaitTime, "how long to wait for startup") subFlags.Parse(args) if err := mysqld.Start(*waitTime); err != nil { log.Fatalf("failed start mysql: %v", err) } }
func startCmd(mysqld *mysqlctl.Mysqld, subFlags *flag.FlagSet, args []string) error { waitTime := subFlags.Duration("wait_time", 2*time.Minute, "how long to wait for startup") subFlags.Parse(args) ctx, cancel := context.WithTimeout(context.Background(), *waitTime) defer cancel() if err := mysqld.Start(ctx); err != nil { return fmt.Errorf("failed start mysql: %v", err) } return nil }