chruby
chruby copied to clipboard
Terminating chruby does not terminate child processes
When running chruby along the lines of `bash -l -c 'chruby-exec 1.9.3 -- some_script.rb' killing the top level chruby process does not terminate the underlying Ruby script.
A simple example:
# /tmp/test.rb
%w{QUIT KILL TERM}.each do |signal|
trap signal do
exit
end
end
loop do
sleep 5
end
Running the command pseudo-monit style (you can also leave the sudo bit out if you run it as the correct user, it won't make a difference):
sudo -H -u your-user-since-this-is-run-as-root bash -l -c "/usr/bin/chruby-exec 1.9.3 -- ruby /tmp/test.rb"
Killing the process (TERM and INT don't do anything so you have to use KILL):
kill -9 `pidof sudo` # lets hope you don't have anything else running with sudo
This results in the chruby command being killed while the underlying Ruby script remains active.
Bummer. This prevents me from using chruby with runit.
Bummer. This prevents me from using chruby with supervisor.