rpi: fix kernel warning when closing camera (#4988) (#5474)

This commit is contained in:
Alessandro Ros
2026-02-21 14:37:37 +01:00
committed by GitHub
parent 85999fbd4d
commit 96d6dbae12
@@ -231,6 +231,12 @@ func (c *camera) initialize() error {
c.cmd.Env = env
c.cmd.Dir = dumpPath
// prevent the subprocess from receiving signals (in particular SIGINT and SIGTERM)
// from the parent process.
c.cmd.SysProcAttr = &syscall.SysProcAttr{
Setpgid: true,
}
err = c.cmd.Start()
if err != nil {
c.pipeOut.close()
@@ -282,24 +288,25 @@ func (c *camera) runInner() error {
return err
case err := <-readDone:
c.pipeIn.close()
c.pipeOut.write([]byte{'e'})
c.pipeOut.close()
<-cmdDone
c.pipeIn.close()
c.pipeOut.close()
return err
case <-c.terminate:
c.pipeIn.close()
<-readDone
c.pipeOut.write([]byte{'e'})
c.pipeOut.close()
<-cmdDone
c.pipeOut.close()
c.pipeIn.close()
<-readDone
return fmt.Errorf("terminated")
}
}