Browse Source

don't create runners manually.

Lucas Stadler 11 years ago
parent
commit
df9298be0f
1 changed files with 5 additions and 1 deletions
  1. 5 1
      go/qst.go

+ 5 - 1
go/qst.go

81
	}
81
	}
82
	log.Printf("command to run: `%s'", cmd)
82
	log.Printf("command to run: `%s'", cmd)
83
83
84
	runner := &Runner{nil, cmd, false, *autoRestart}
84
	runner := MakeRunner(cmd, *autoRestart)
85
	go runCmd(file, runner)
85
	go runCmd(file, runner)
86
86
87
	c := make(chan os.Signal, 1)
87
	c := make(chan os.Signal, 1)
118
	restart  bool
118
	restart  bool
119
}
119
}
120
120
121
func MakeRunner(shellCmd string, restart bool) *Runner {
122
	return &Runner{nil, shellCmd, false, restart}
123
}
124
121
func (r *Runner) Start() error {
125
func (r *Runner) Start() error {
122
	if r.started {
126
	if r.started {
123
		return errors.New("already started, use Restart()")
127
		return errors.New("already started, use Restart()")