Created
November 20, 2014 08:45
-
-
Save drewbug/a445860f5b26d0eb31b5 to your computer and use it in GitHub Desktop.
youtube-dl hang workaround
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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