[ANN] terminator-0.4.2

Discussion in 'Ruby' started by ara howard, Sep 10, 2008.

  1. ara howard

    ara howard Guest

    NAME
    terminator

    SYNOPSIS
    an external timeout mechanism based on processes and signals. safe
    on
    windows. safe for system calls. safe for minors.

    INSTALL
    gem install terminator

    URIS
    http://codeforpeople.com/lib/ruby
    http://rubyforge.org/projects/codeforpeople

    HISTORY
    0.4.2
    initial version with

    AUTHORS
    ara.t.howard
    mikel lindsaar

    SAMPLES

    <========< samples/a.rb >========>

    ~ > cat samples/a.rb

    require 'terminator'

    Terminator.terminate 2 do
    sleep 4
    end

    ~ > ruby samples/a.rb

    samples/a.rb:3: 2s (Terminator::Error)
    from samples/a.rb:3


    <========< samples/b.rb >========>

    ~ > cat samples/b.rb

    require 'terminator'

    Terminator.terminate 0.2 do
    sleep 0.4 rescue puts 'timed out!'
    end

    ~ > ruby samples/b.rb

    timed out!


    <========< samples/c.rb >========>

    ~ > cat samples/c.rb

    require 'terminator'

    begin
    Terminator.terminate :seconds => 0.2 do
    sleep 0.4
    end
    rescue Terminator.error
    puts 'timed out!'
    end

    ~ > ruby samples/c.rb

    timed out!


    <========< samples/d.rb >========>

    ~ > cat samples/d.rb

    require 'terminator'

    trap = lambda{ puts "signaled @ #{ Time.now.to_i }" }

    Terminator.terminate :seconds => 1, :trap => trap do
    sleep 2
    puts "woke up @ #{ Time.now.to_i }"
    end

    ~ > ruby samples/d.rb

    signaled @ 1221026177
    woke up @ 1221026178




    a @ http://codeforpeople.com/
    --
    we can deny everything, except that we have the possibility of being
    better. simply reflect on that.
    h.h. the 14th dalai lama
    ara howard, Sep 10, 2008
    #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. Mack Attack
    Replies:
    3
    Views:
    6,888
    Roedy Green
    Aug 8, 2003
  2. David Hirschfield

    Help: asyncore/asynchat and terminator string

    David Hirschfield, Jan 16, 2007, in forum: Python
    Replies:
    0
    Views:
    304
    David Hirschfield
    Jan 16, 2007
  3. semut
    Replies:
    3
    Views:
    383
    Binary
    Dec 1, 2006
  4. dbtouch
    Replies:
    32
    Views:
    3,195
    Jerry Coffin
    Mar 8, 2009
  5. Mikel Lindsaar

    [ANN] Terminator 0.4.4

    Mikel Lindsaar, Sep 21, 2008, in forum: Ruby
    Replies:
    0
    Views:
    97
    Mikel Lindsaar
    Sep 21, 2008
Loading...

Share This Page