fix goroutine call for commands with no handlers

This commit is contained in:
Shane C 2024-07-11 16:34:08 -04:00
parent 2a59a80b11
commit 2b190eccb7
Signed by: shane
GPG key ID: E46B5FEA35B22FF9

View file

@ -119,7 +119,10 @@ func (cmd *LinuxCommand) Run() error {
} }
} }
cmd.wg.Add(3) cmd.wg.Add(1)
if len(cmd.handlers) != 0 {
cmd.wg.Add(2)
go func() { go func() {
defer cmd.wg.Done() defer cmd.wg.Done()
@ -153,6 +156,7 @@ func (cmd *LinuxCommand) Run() error {
} }
} }
}() }()
}
go func() { go func() {
defer cmd.wg.Done() defer cmd.wg.Done()