azimut / ffbar

progress bar for ffmpeg
MIT License
0 stars 0 forks source link

make sure child process gets killed on error #12

Open azimut opened 4 months ago

azimut commented 4 months ago

Somehow I found that if the parsing found an error #11 and exited the ffmpeg process was still running orphan.

Example:

$ ffbar -ss 00:00:22 -t 1777 -i foo.mp4 -r 15 -ac 1 -ar 22050 -vf scale=960:-1 bar.mp4
Fatal error: exception End_of_file
azimut commented 6 days ago

this is harder than I though, while i can use try/with to capture the exception of my OCaml code, I cannot kill the remaining processes. Unix.kill with Unix.process_pid_in only kills a parent process while the other process runs amok. Maybe with a different stdlib library this would be easier.