I\'m using RVM, Ruby 1.9.2, and Rails 3.0.7
A standard kill of the process from another terminal doesn\'t work, either, but kill -9 does, of course.
I found
I believe ^C can't kill WEBrick servers because the server creates a new session:
In webrick/server.rb:
class Daemon def Daemon.start exit!(0) if fork Process::setsid exit!(0) if fork Dir::chdir("/") File::umask(0) STDIN.reopen("/dev/null") STDOUT.reopen("/dev/null", "w") STDERR.reopen("/dev/null", "w") yield if block_given? end end
(Very similar code exists in rack/server.rb, so if you're starting WEBrick via rack, you might want to leave off the -D or --daemonize command line options.)
And from the setsid(2) manpage:
setsid() creates a new session if the calling process is not a process group leader. The calling process is the leader of the new session, the process group leader of the new process group, and has no controlling tty.
has no controlling tty means that signals generated by a terminal (^Z SIGTSTP, ^\ SIGKILL, SIGTTIN, SIGTTOU, etc.) can't reach the process even if it had been started on that terminal. The link has been severed.