How to exit Ruby program properly

Discussion in 'Ruby' started by Jeff Cohen, Dec 13, 2005.

  1. Jeff Cohen

    Jeff Cohen Guest

    I'm learning to write ruby code, and I'm using 1.8.2 on Windows XP.
    What is the best way to exit from my .rb script?

    I'm using Process.exit but the documentation implies that it will throw
    an exception. So I'm guessing there's a "cleaner" way to exit?

    For example:

    test.rb
    ====================
    if ARGV.length == 0
    puts "Please specify a filename"
    Process.exit
    end

    # script continues here...


    Thanks!
    Jeff

    --
    Posted via http://www.ruby-forum.com/.
    Jeff Cohen, Dec 13, 2005
    #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. =?Utf-8?B?U2FuZHk=?=

    Code to Exit Web App and Exit Internet Explorer

    =?Utf-8?B?U2FuZHk=?=, Aug 3, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    7,889
    =?Utf-8?B?U2FuZHk=?=
    Aug 5, 2005
  2. Joe Smith
    Replies:
    4
    Views:
    65,827
    sandeep1976
    Nov 8, 2006
  3. Replies:
    2
    Views:
    450
    Jeff Epler
    May 31, 2005
  4. QQ
    Replies:
    5
    Views:
    514
    Jonathan Adams
    May 10, 2005
  5. Vicky

    Difference between exit(0) & exit (1)

    Vicky, Aug 8, 2006, in forum: C Programming
    Replies:
    6
    Views:
    705
    Kenneth Brody
    Aug 8, 2006
Loading...

Share This Page