I'm trying to properly terminate a command
c := exec.Command("omxplayer", "video.mp4")
c.Start()
// send kill signal to terminate command at later stage
time.Sleep(4*time.Second)
c.Process.Kill()
c.Wait() // should wait for program to fully exit
// start again with new video
c := exec.Command("omxplayer", "video2.mp4")
c.Start()
I'm trying to kill the current omxplayer
process on my Raspberry-Pi so that I can start it again with a new video.
Once I send the Kill
signal, I call c.Wait()
to wait for the current command to end before starting a new command.
The Problem is that the first command is not stopping, but the next command is starting anyway. So I end up with multiple videos being played at the same time.