Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Terminating chruby does not terminate child processes #154

Open
YorickPeterse opened this Issue · 1 comment

2 participants

Yorick Peterse Alexey Palazhchenko
Yorick Peterse

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.

Alexey Palazhchenko

Bummer. This prevents me from using chruby with runit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.