GoWSL
GoWSL copied to clipboard
Cmd does not allow Wait to be called multiple times
In the function definition of Wait for the Cmd struct, the finished boolean prevents Wait from being called more than once
if c.finished {
return errors.New("Wait was already called")
}
c.finished = true
state, err := c.Process.Wait()
This behavior is different from exec.Cmd where Wait can be called multiple times. Allowing this makes certain concurrent tasks easier to synchronize.