Why is it so hard to kill Ruby?

T

Tim Hunter

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?
 
R

Ryan Davis

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
 
G

georgebudd

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 = <undef>;
eol2 = <undef>; erase = ^?; intr = ^C; kill = ^U; lnext = ^V;
min = 1; quit = ^\; reprint = ^R; start = ^Q; status = ^T;
stop = ^S; susp = ^Z; time = 0; werase = ^W;
"
 
G

Giles Bowkett

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.
 
A

Alex Young

Tim said:
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.
 
J

James Britt

Tim said:
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 Britt

"The trouble with the world is that the stupid are cocksure and the
intelligent are full of doubt."
- Bertrand Russell
 
C

Chris Carter

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 ....



--

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....
 
R

Robert Dober

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?
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.
 
T

Tanaka Akira

Tim Hunter said:
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.
 
D

Dido Sevilla

T24gNy8yNi8wNywgUm9iZXJ0IERvYmVyIDxyb2JlcnQuZG9iZXJAZ21haWwuY29tPiB3cm90ZToK
PiBPbiA3LzI2LzA3LCBDaHJpcyBDYXJ0ZXIgPGNkY2FydGVyQGdtYWlsLmNvbT4gd3JvdGU6Cj4g
IDxzbmlwPgo+ID4gIE5vdywKPiA+IGhlIGhhZCBhIG5ldyBtaXNzaW9uLi4uLgo+IHlvdSBtZWFu
ICJzaGUiLCByaWdodCA7KQoKSW5kZWVkLS0KCmh0dHA6Ly93d3cueW9zaGlkYW0ubmV0L1J1Ynkt
Y2hhbi8KCkl0J3Mgc3RhcnRpbmcgdG8gc291bmQgbGlrZSB0aGUgcGxvdCBmb3IgYSBzaG91bmVu
IG1hbmdhIGFjdHVhbGx5Li4uIDspCgotLSAK5pmu6YCa44GY44KD44Gq44GE44Gu44GM5b2T54S2
44Gq44KJ562U44GI44KL56eB44Gv5L2V44GM44Gn44GN44KL77yfCuaZrumAmuOBp+OCguaZrumA
muOBmOOCg+OBquOBj+OBpuaEn+OBmOOCi+OBvuOBvuaEn+OBmOOCi+OBk+OBqOOBoOOBkeOCkuOB
meOCi+OCiO+8gQpodHRwOi8vc3Rvcm13eXJtLmJsb2dzcG90LmNvbQo=
 
D

David Harkness

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top