about interrupt...

Discussion in 'Ruby' started by Kyung won Cheon, Jan 16, 2009.

  1. * Test.java

    import java.io.FileOutputStream;

    public class Test
    {
    public static void main(String[] args) throws Exception
    {
    Runtime.getRuntime().addShutdownHook(new Thread()
    {
    public void run()
    {
    try {
    new FileOutputStream("shutdown.log").close();
    } catch (Exception ioe) {
    }
    }
    }
    );
    System.out.println("sleeping...");
    Thread.sleep(100000);
    }
    }

    * test.rb

    trap('INT') { File.open('shutdown.log', 'w').close }
    puts 'sleeping...'
    sleep(100)

    #----------------------------------------------------------
    # I using windows XP
    # (ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32])
    #
    # In Java,
    # Ctrl+C and click [x] button of command window are ok!!
    # In Ruby
    # Only Ctrl+C is ok!!
    #
    # Help Me!!
    #----------------------------------------------------------
    --
    Posted via http://www.ruby-forum.com/.
    Kyung won Cheon, Jan 16, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Tony
    Replies:
    0
    Views:
    1,032
  2. prabhu
    Replies:
    1
    Views:
    514
    Ralf Hildebrandt
    Feb 25, 2004
  3. Roberto
    Replies:
    1
    Views:
    2,799
    Stefan Oedenkoven
    Nov 21, 2004
  4. Gianni

    Sqlplus -S interrupt !!!!

    Gianni, Jun 17, 2004, in forum: Perl
    Replies:
    0
    Views:
    2,936
    Gianni
    Jun 17, 2004
  5. krby_xtrm

    PCI Interrupt

    krby_xtrm, Dec 16, 2005, in forum: VHDL
    Replies:
    0
    Views:
    554
    krby_xtrm
    Dec 16, 2005
Loading...

Share This Page