code: func initTtySize(ctx context.Context, cli command.Cli, id string, isExec bool, resizeTtyFunc func(ctx context.Context, cli command.Cli, id string, isExec bool) error) {
  	rttyFunc := resizeTtyFunc
  	if rttyFunc == nil {
  		rttyFunc = resizeTty
  	}
  	if err := rttyFunc(ctx, cli, id, isExec); err != nil {
  		go func() {
  			var err error
  			for retry := 0; retry < 5; retry++ {
  				time.Sleep(10 * time.Millisecond)
  				if err = rttyFunc(ctx, cli, id, isExec); err == nil {
  					break
  				}
  			}
  			if err != nil {
  				fmt.Fprintln(cli.Err(), "failed to resize tty, using default size")
  			}
  		}()
  	}
  }
docs: // initTtySize is to init the tty's size to the same as the window, if there is an error, it will retry 5 times.