device/raspivid: fix of closing closed chan

This commit is contained in:
Saxon Nelson-Milton 2020-03-31 10:13:21 +01:00
parent 09a763728e
commit 1525714439
1 changed files with 3 additions and 0 deletions

View File

@ -305,6 +305,9 @@ func (r *Raspivid) Read(p []byte) (int, error) {
// Stop will terminate the raspivid process and close the output pipe.
func (r *Raspivid) Stop() error {
if r.isRunning == false {
return nil
}
close(r.done)
if r.cmd == nil || r.cmd.Process == nil {
return errors.New("raspivid process was never started")