Created
October 17, 2016 13:49
-
-
Save a2ikm/d118aec59bb6093236df91c0fb364520 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env ruby | |
pid = fork do | |
exec "long long command" | |
end | |
%i(TERM QUIT INT).each do |sig| | |
trap(sig) do | |
Process.kill(sig, pid) | |
end | |
end | |
Process.waitpid(pid) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment