Bharat Ruparel wrote:
> I am going through Dave Thomas's Programming Ruby Second Edition book.
> I am trying to execute the code given on page 89 of the book which is as
> follows:
> 
> # Sample code from Programing Ruby, page 83
>   alias old_backquote `
>   def `(cmd)
>     result = old_backquote(cmd)
>     if $? != 0
>       fail "Command #{cmd} failed: #$?"
>     end
>     result
>   end
>   print `date`
>   print `data`
> 
> when I try to run this code by typing
> 
> ruby ex200.rb at the command prompt (on Windows XP machine), the program
> hangs.  When I abot it by hitting CTRL-C key combination, I get the
> following stack-trace:
> 
> ex0200.rb:4:in `old_backquote': Interrupt
>         from ex0200.rb:4:in ``'
>         from ex0200.rb:10
> 
> I don't quite understand what is going on here.

Windows waits for an Input!

If you enter "date" in a console window, the system will ask you to 
enter a new date. When youn press "enter" instead of CTRL-C, the 
reaction will be as described in the book.


Wolfgang NĂ¡dasi-Donner

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