Signal example

Hi,

Can anybody provide a ruby signal example ?

I am running a simple program contains,

···

#######################
sleep (10)

trap.Signal('SIGNIT') { proc to handle signal }
#####################

If i will do (Ctrl + c), it should go to proc . But its not working.
Does anybody have working example? Thanks in advance.
--
Posted via http://www.ruby-forum.com/.

trap('INT'){puts "^C"}

···

--
Posted via http://www.ruby-forum.com/.

What did you try and what is not working?

Kind regards

robert

···

2009/11/23 Karan Rajput <ganeshgirase@gmail.com>:

Hi,

Can anybody provide a ruby signal example ?

I am running a simple program contains,

#######################
sleep (10)

trap.Signal('SIGNIT') { proc to handle signal }
#####################

If i will do (Ctrl + c), it should go to proc . But its not working.
Does anybody have working example? Thanks in advance.

--
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Hi,

Can anybody provide a ruby signal example ?

I am running a simple program contains,

#######################
sleep (10)

trap.Signal('SIGNIT') { proc to handle signal }

              ^^^^^^

Should be SIGINT or just INT.

···

On Nov 23, 2009, at 1:28 AM, Karan Rajput wrote:

#####################

If i will do (Ctrl + c), it should go to proc . But its not working.
Does anybody have working example? Thanks in advance.
--
Posted via http://www.ruby-forum.com/\.