shaka-project / shaka-streamer

A simple config-file based approach to preparing streaming media, based on FFmpeg and Shaka Packager.
https://shaka-project.github.io/shaka-streamer/
Apache License 2.0
199 stars 62 forks source link

fix(external command): Create the new shell process in a new group #96

Closed mariocynicys closed 2 years ago

mariocynicys commented 2 years ago

When launching a process as a shell, what happens is that Popen creates a shell then the shell forks itself and calls exev system call to run the program we intended to run in the shell.

Popen
  |
  V
shell -fork-> another-shell
  |                 |
  V                exev
                    |
                    V
              external-command

We have access to the shell it self from self._process which we actually don't need. We need the pid of external-command instead.

This PR launches the spawned shell in a new group so that we can just kill the group all together when stop is called.

fixes #46

joeyparrish commented 2 years ago

Thank you!