Terminating chruby does not terminate child processes #154

YorickPeterse opened this Issue Jun 14, 2013 · 2 comments


None yet

3 participants

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

loop do
  sleep 5

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.

AlekSi commented Oct 20, 2014

Bummer. This prevents me from using chruby with runit.

Bummer. This prevents me from using chruby with supervisor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment