Why is it so hard to kill Ruby?

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9. Today I
notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been this way since I
started using Ruby 6 or so years ago on Mandrake Linux. Do I have the
wrong expectations?

On Jul 25, 2007, at 15:50 , Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script
is hard to kill. Control-C won’t do it. I have to use kill -9.
Today I notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been
this way since I started using Ruby 6 or so years ago on Mandrake
Linux. Do I have the wrong expectations?

works for me on same(ish) setup

Same here, Currently running 1.8.6 on 10.4.10 and ctrl-c kills nearly
any
script with no issue.

On Jul 25, 8:00 pm, Ryan D. [email protected] wrote:

On Jul 25, 2007, at 15:50 , Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script
is hard to kill. Control-C won’t do it. I have to use kill -9.
Today I notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been
this way since I started using Ruby 6 or so years ago on Mandrake
Linux. Do I have the wrong expectations?

works for me on same(ish) setup

For what it’s worth. If you run “stty -a” from your shell what do you
get?

Partial output from my system:

"cchars: discard = ^O; dsusp = ^Y; eof = ^D; eol = ;
eol2 = ; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
"

Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9. Today I
notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been this way since I
started using Ruby 6 or so years ago on Mandrake Linux. Do I have the
wrong expectations?

I’ve been confused by this when WEBrick traps signals I’m not expecting
it to. Try manually specifying a trap block for QUIT and TERM, and see
if that helps.

Because Ruby’s hands are lethal weapons. Because they took everything
Ruby had, and left Ruby for dead. The chief doesn’t agree with Ruby’s
methods, but Ruby gets the job done, even if Ruby does have to blow up
half the city to do it. There just wasn’t no law at all round these
here parts til Ruby rode into town.


Giles B.

Blog: http://gilesbowkett.blogspot.com
Portfolio: http://www.gilesgoatboy.org

Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9.

Soon Ruby will be unstoppable.

After a freak accident in Dr. Dynamic’s underground lab, Ruby was
exposed to unshielded metacoderite. When not hindered by a buffer of
significant indentation, metacoderite has unimaginably powerful
properties.

Within days, Ruby had the strength of ten men, and could hear the
thoughts of children and small animals.

As time passed, Ruby only becomes more powerful.

Can anything stop Ruby?

Stay tuned …


James B.

“The trouble with the world is that the stupid are cocksure and the
intelligent are full of doubt.”

  • Bertrand Russell

On 7/26/07, James B. [email protected] wrote:

Within days, Ruby had the strength of ten men, and could hear the
thoughts of children and small animals.

As time passed, Ruby only becomes more powerful.

Can anything stop Ruby?
If I have understood correctly Ruby also has undergone some dangerous
mutations that will make it even more powerful, scientists have
categorized these strains into JRuby, IronRuby, Rubinius and YARV.
As far as I know vaccination is impossible.
intelligent are full of doubt."
Hmm I do not know.

On 7/26/07, Chris C. [email protected] wrote:

Now,
he had a new mission…
you mean “she”, right :wink:


Chris C.
concentrationstudios.com
brynmawrcs.com

Robert

On 7/26/07, James B. [email protected] wrote:

Within days, Ruby had the strength of ten men, and could hear the

As a child, Ruby had heard rumors of a promised land. Where POSIX
compliant binaries could work side by side with pretty graphics. Ruby
was intrigued. Ruby had never believed them at first, but now Ruby
went on a quest. Ruby searched and searched across a mass of
torrents, and found the land known as OS10.4. Ruby did not understand
the designation. Yet Ruby knew it was what he had sought. Ruby
fought his way to be a member of the council, sitting in the House of
/usr/bin. A highest honor. Nobody knew of his super-powers. None of
them had even heard of metacoderite. Until that sweltering August
day, when Ruby decided it was time to take some charge. After months
of planning, Ruby gagged and bound Objective-C and stole his runtime,
Ruby grew stronger still, filled with the powers of the Cocoa. Now,
he had a new mission…

On 7/26/07, Robert D. [email protected] wrote:

On 7/26/07, Chris C. [email protected] wrote:

Now,
he had a new mission…
you mean “she”, right :wink:

Ruby has no gender. Ruby still needs a personal pronoun. They and
he/she are both to bulky for Ruby.

On 7/26/07, Chris C. [email protected] wrote:

On 7/26/07, Robert D. [email protected] wrote:

On 7/26/07, Chris C. [email protected] wrote:

Now,
he had a new mission…
you mean “she”, right :wink:

Ruby has no gender.
Hmm are you sure, I have looked you know…
Ruby still needs a personal pronoun. They and
he/she are both to bulky for Ruby.
That is true, probably that can only be expressed in Japanese :wink:

Chris C.
concentrationstudios.com
brynmawrcs.com

Robert

On 7/26/07, Robert D. [email protected] wrote:

On 7/26/07, Chris C. [email protected] wrote:

Now,
he had a new mission…
you mean “she”, right :wink:

Indeed–

http://www.yoshidam.net/Ruby-chan/

It’s starting to sound like the plot for a shounen manga actually… :wink:

I’ve written some scripts that are nearly immortal.

Basically I wrote a loop, with a couple layers of rescues.

The Ctrl C would Raise an error, which would be caught by a rescue, and
then the loop would start again.

My final solution, I’m sure there are more elegant ones, was to to put a
sleep 5, after a rescue clause, before the loop started again.

This gave time to get two Ctrl C’s in.

Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9. Today I
notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been this way since I
started using Ruby 6 or so years ago on Mandrake Linux. Do I have the
wrong expectations?

In article [email protected],
Tim H. [email protected] writes:

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9. Today I
notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been this way since I
started using Ruby 6 or so years ago on Mandrake Linux. Do I have the
wrong expectations?

I know a script that is hard to kill.

% ruby-1.8.6 -e ‘loop { p system(“sleep 1”) }’

Your problem may be different.

On Jul 27, 2007, at 16:20 , David H. wrote:

sleep 5, after a rescue clause, before the loop started again.

This gave time to get two Ctrl C’s in.

Tim H. wrote:

Since I’ve been using Ruby I’ve noticed that a running Ruby script is
hard to kill. Control-C won’t do it. I have to use kill -9. Today I
notice it with Ruby 1.8.6 on OS X 10.4.9, but it’s been this way
since I
started using Ruby 6 or so years ago on Mandrake Linux. Do I have the
wrong expectations?

Or you could wrap the script to explicitly catch that signal sent
from the command line.