func shellOut()

in plugin/step/install/windows/msi/msi_windows.go [58:76]


func shellOut(s *Step, cm string, args []string) (err error) {
	done := make(chan error)
	ctx, cancel := context.WithTimeout(context.Background(), time.Second*time.Duration(s.MSIEXECTimeoutSeconds))
	defer cancel()

	go func() {
		cmd := exec.CommandContext(ctx, cm, args...)
		s.logger.Debugf(1, "%v: %v %v", s.Name(), cm, strings.Join(args, " "))
		done <- cmd.Run()
	}()

	select {
	case err = <-done:
	case <-ctx.Done():
		return fmt.Errorf("%s timed out", s.Name())
	}

	return err
}