Exemple #1
0
// ExecBash runs script expressions in a single bash session. Execution loop
// does not stop, even if one of the commands exits with a code != 0.
// The function returns the last error encountered, if any.
func ExecBash(cmds []string, w io.Writer) error {
	s, err := bash.NewSession(w)
	if err != nil {
		return err
	}
	for _, cmd := range cmds {
		s.Start(cmd)
	}
	return s.Close()
}
Exemple #2
0
// TODO(rjeczalik): Support matrix builds, use 'detail' to configure local execution. (#2)
// TODO(rjeczalik): Support after_success/after_failure stages. (#1)
func (travis) Exec(detail string, p []byte, w io.Writer) error {
	pro, err := travisParse(p)
	if err != nil {
		return err
	}
	cmd := travisCmd(pro)
	if cmd == nil {
		return errors.New("travis: no commands found")
	}
	s, err := bash.NewSession(w)
	if err != nil {
		return err
	}
	for _, stage := range stages {
		if cmd, ok := cmd[stage]; ok {
			for _, cmd := range cmd {
				s.Start(cmd)
			}
		}
	}
	return s.Close()
}