Created
September 22, 2014 11:18
-
-
Save stevendanna/6972fd94779f03ac89f8 to your computer and use it in GitHub Desktop.
sigign(1): start process with signal disposition set to SIG_IGN
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
| #!/usr/bin/env ruby | |
| # | |
| # sigign: exec a command with signals ignored | |
| # | |
| # Usage: sigign SIGNAL[,SIGNAL..] COMMAND | |
| # | |
| # sigign sets the disposition of the specified signals to SIG_IGN | |
| # before exec'ing the specified command. | |
| ignored_signals = ARGV.shift.split(",") | |
| command = ARGV.join(" ") | |
| ignored_signals.each do |sig| | |
| trap(sig, "SIG_IGN") | |
| end | |
| exec(command) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment