func (sv *Unit) Define(r io.Reader /*, errch chan<- error*/) (err error) {
	log.WithField("r", r).Debugf("sv.Define")

	def := Definition{}
	def.Service.Type = DEFAULT_TYPE

	if err = unit.ParseDefinition(r, &def); err != nil {
		return
	}

	merr := unit.MultiError{}

	// Check definition for errors
	switch {
	case def.Service.ExecStart == "":
		merr = append(merr, unit.ParseErr("ExecStart", unit.ErrNotSet))

	case !Supported(def.Service.Type):
		merr = append(merr, unit.ParseErr("Type", unit.ParseErr(def.Service.Type, unit.ErrNotSupported)))
	}

	if len(merr) > 0 {
		return merr
	}

	sv.Definition = def

	cmd := strings.Fields(def.Service.ExecStart)
	sv.Cmd = exec.Command(cmd[0], cmd[1:]...)
	sv.Cmd.Dir = sv.Definition.Service.WorkingDirectory

	return nil
}
// Define attempts to fill the sv definition by parsing r
Define attempts to fill the sv definition by parsing r
// Define attempts to fill the sv definition by parsing r
func (sv *Unit) Define(r io.Reader ) (err error) {
	log.WithField("r", r).Debugf("sv.Define")
	def := Definition{}
	def.Service.Type = DEFAULT_TYPE
	if err = unit.ParseDefinition(r, &def); err != nil {
		return
	}
	merr := unit.MultiError{}
	switch {
	case def.Service.ExecStart == "":
		merr = append(merr, unit.ParseErr("ExecStart", unit.ErrNotSet))
	case !Supported(def.Service.Type):
		merr = append(merr, unit.ParseErr("Type", unit.ParseErr(def.Service.Type, unit.ErrNotSupported)))
	}
	if len(merr) > 0 {
		return merr
	}
	sv.Definition = def
	cmd := strings.Fields(def.Service.ExecStart)
	sv.Cmd = exec.Command(cmd[0], cmd[1:]...)
	sv.Cmd.Dir = sv.Definition.Service.WorkingDirectory
	return nil
}
func ( sv * Unit ) Define ( r io . Reader ) ( err error ) { log . WithField ( " " , r ) . Debugf ( " " ) def := Definition { } def . Service . Type = DEFAULT_TYPE if err = unit . ParseDefinition ( r , & def ) ; err != nil { return } merr := unit . MultiError { } switch { case def . Service . ExecStart == " " : merr = append ( merr , unit . ParseErr ( " " , unit . ErrNotSet ) ) case ! Supported ( def . Service . Type ) : merr = append ( merr , unit . ParseErr ( " " , unit . ParseErr ( def . Service . Type , unit . ErrNotSupported ) ) ) } if len ( merr ) > 0 { return merr } sv . Definition = def cmd := strings . Fields ( def . Service . ExecStart ) sv . Cmd = exec . Command ( cmd [ 0 ] , cmd [ 1 : ] ... ) sv . Cmd . Dir = sv . Definition . Service . WorkingDirectory return nil }
Define attempts to fill the sv definition by parsing r
Define attempts to fill the sv definition by parsing r
/*, errch chan<- error*/ // Check definition for errors