code: func (p *Plugin) templateToProcess(tmp *process.Template) (*Process, error) {
  	if tmp.Name == "" {
  		return nil, errors.Errorf("cannot create process from template, missing name")
  	}
  	if tmp.Cmd == "" {
  		return nil, errors.Errorf("cannot create process from template, missing command")
  	}
  
  	pOptions := &POptions{}
  	if tmp.POptions != nil {
  		pOptions.args = tmp.POptions.Args
  		pOptions.outWriter = func(isSet bool) io.Writer {
  			if isSet {
  				return os.Stdout
  			}
  			return nil
  		}(tmp.POptions.OutWriter)
  		pOptions.errWriter = func(isSet bool) io.Writer {
  			if isSet {
  				return os.Stderr
  			}
  			return nil
  		}(tmp.POptions.ErrWriter)
  		pOptions.detach = tmp.POptions.Detach
  		pOptions.restart = tmp.POptions.Restart
  		pOptions.runOnStartup = tmp.POptions.RunOnStartup
  		pOptions.notifyChan = func(notify bool) chan status.ProcessStatus {
  			if notify {
  				return make(chan status.ProcessStatus)
  			}
  			return nil
  		}(tmp.POptions.Notify)
  		pOptions.autoTerm = tmp.POptions.AutoTerminate
  	}
  
  	return &Process{
  		log:     p.Log,
  		name:    tmp.Name,
  		cmd:     tmp.Cmd,
  		options: pOptions,
  		sh:      &status.Reader{Log: p.Log},
  		status: &status.File{
  			State: status.Initial,
  		},
  		cancelChan: make(chan struct{}),
  	}, nil
  }
docs: // Create a process object from template. A name and a command are mandatory