Skip to content

Instantly share code, notes, and snippets.

@stevendanna
Created September 22, 2014 11:18
Show Gist options
  • Select an option

  • Save stevendanna/6972fd94779f03ac89f8 to your computer and use it in GitHub Desktop.

Select an option

Save stevendanna/6972fd94779f03ac89f8 to your computer and use it in GitHub Desktop.
sigign(1): start process with signal disposition set to SIG_IGN
#!/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