1
0
Fork 0

Get rid of run() in favour of just wrapping it in Start()

This commit is contained in:
Sebastian Schulze 2022-03-04 20:24:42 +01:00
parent f2c80f1a2d
commit 7b971eea37
Signed by: bascht
GPG Key ID: 5BCB1D3B4D38A35A
2 changed files with 2 additions and 6 deletions

View File

@ -13,11 +13,8 @@ type Command struct {
cmd *exec.Cmd
}
func (command *Command) run() {
command.cmd = exec.Command(command.Name, command.Args...)
}
func (command *Command) Start() {
command.cmd = exec.Command(command.Name, command.Args...)
command.cmd.Start()
}
@ -26,7 +23,6 @@ func (command *Command) Wait() {
}
func (command *Command) NewScanner() *bufio.Scanner {
command.run()
stderr, err := command.cmd.StderrPipe()
if err != nil {

View File

@ -30,6 +30,7 @@ func Process(basedir string, document *Document) string {
for _, command := range commands {
done := make(chan bool)
command.Start()
go func() {
document.Events <- command.Name + " Startet"
@ -41,7 +42,6 @@ func Process(basedir string, document *Document) string {
document.Events <- command.Name + " Ist fast fertig"
done <- true
}()
command.Start()
document.Events <- command.Name + " Ist gestartet"
command.Wait()
<-done