Skip to content

Instantly share code, notes, and snippets.

@drewbug
Created November 20, 2014 08:45
Show Gist options
  • Save drewbug/a445860f5b26d0eb31b5 to your computer and use it in GitHub Desktop.
Save drewbug/a445860f5b26d0eb31b5 to your computer and use it in GitHub Desktop.
youtube-dl hang workaround
require 'timeout'
loop do
pid = fork
if pid.nil?
exec("youtube-dl https://www.youtube.com/playlist?list=PL47F408D36D4CF129")
else
begin
Timeout::timeout(15 * 60) {
Process.waitpid(pid, 0)
}
rescue Timeout::Error
Process.kill("HUP", pid)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment