Exemple #1
0
func (s *Script) GetCommand(logger common.Logger) (*exec.Cmd, error) {
	args := []string{
		"run",
		s.Path,
		s.Log,
		s.Command,
	}

	if logger != nil {
		logger.Printf("Generating script command: %v %v", os.Args[0], args)
	}

	cmd := exec.Command(os.Args[0], args...)
	// TODO: Cache all output from the command and output it on failure as needed
	cmd.Stderr = os.Stderr
	cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
	return cmd, nil
}
Exemple #2
0
func printf(logger common.Logger, f string, v ...interface{}) {
	if logger != nil {
		logger.Printf(f, v...)
	}
}