nichobi / sponsorblockcast

A shell script that skips sponsored YouTube content on all local Chromecasts
GNU General Public License v3.0
348 stars 15 forks source link

Docker: Fix for PS bug spawning endless script threads #10

Closed Ceralor closed 3 years ago

Ceralor commented 3 years ago

Alpine's included ps does not support the -p flag. Added procps package to include that support. Also thought I submitted other fix for zero byte file but it's acting as if I had not, weird.

nichobi commented 3 years ago

If ps -p won't reliably work across distros, maybe we're better off using something else to test if the process is still running. One alternative is kill -0 $PID which seems to be part of POSIX and should therefore work on any distro. I'll do some testing with that before merging this, it would be better to have a universal solution.

nichobi commented 3 years ago

As far as I understand, that should resolve it, but do let me know if it's still causing trouble

Ceralor commented 3 years ago

I'll test it in the Docker build as well. I started to use grep since the full version is already being installed due to the need for PCRE in the script, with the built-in version having minimal or no support for it in Alpine Linux. The main reason to use Alpine Linux here as well is because I don't need all of the bloat that comes with using the Ubuntu or other distro images, and it means the resulting Docker image is less than 25 MB in size.

The grep and ps baked in Alpine is the busybox version, hence the minimalism. Installing the standard ps binary via procps makes it behave. It may be safe to continue to use that ps instruction unless there are concerns about it working correctly on non-Linux platforms such as BSD, but as you said, kill is probably a little bit more reliable. I'll give it a try, and can submit a new PR if it works out fine.