From 1525714439f952429162c61fc1ac30c516f2f00f Mon Sep 17 00:00:00 2001 From: Saxon Nelson-Milton Date: Tue, 31 Mar 2020 10:13:21 +0100 Subject: [PATCH] device/raspivid: fix of closing closed chan --- device/raspivid/raspivid.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/device/raspivid/raspivid.go b/device/raspivid/raspivid.go index d6311825..ae77d8e2 100644 --- a/device/raspivid/raspivid.go +++ b/device/raspivid/raspivid.go @@ -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")