Граф коммитов

28 Коммитов

Автор SHA1 Сообщение Дата
Benoit Daloze 354cd6f210 [ruby/timeout] Handle Timeout + fork and add test for it
https://github.com/ruby/timeout/commit/4baee63b9b
2022-05-19 07:19:40 +09:00
Benoit Daloze 89fbec224d [ruby/timeout] Reimplement Timeout.timeout with a single thread and a Queue
https://github.com/ruby/timeout/commit/2bafc458f1
2022-05-19 07:19:39 +09:00
John Bachir 1147136b8a [ruby/timeout] test that yield is given number of seconds
https://github.com/ruby/timeout/commit/ec5a614334
2021-09-28 06:05:50 +09:00
John Bachir 582602d142 [ruby/timeout] test for basic functionality
https://github.com/ruby/timeout/commit/1c6bb90aea
2021-09-27 13:22:46 +09:00
Jeremy Evans 33b5e179a8 [ruby/timeout] Make Timeout::Error#exception with multiple arguments not ignore arguments
This makes:

  raise(Timeout::Error.new("hello"), "world")

raise a TimeoutError instance with "world" as the message instead
of "hello", for consistency with other Ruby exception classes.

This required some internal changes to keep the tests passing.

Fixes [Bug #17812]

https://github.com/ruby/timeout/commit/952154dbf9
2021-05-06 16:49:26 +09:00
kazu 6064132c42 Remove unnecessary `require 'thread'`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60139 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-08 07:00:01 +00:00
kazu d6e4975eaf Use our domain instead of other's domain
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56093 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 12:32:04 +00:00
nobu 047ca4ba1a timeout.rb: custom error message
* lib/timeout.rb (Timeout#timeout): add custom error message
  argument.  [Feature #11650]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56089 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07 08:21:56 +00:00
nobu 4b298ad77a Use qualified names
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56037 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-08-30 06:22:30 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu e0d6328ff4 test_timeout.rb: exact messages
* test/test_timeout.rb (test_rescue_exit, test_custom_exception):
  assert with exact messages.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52433 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-03 12:15:31 +00:00
nobu beb1c085d5 use Timeout.timeout
* time: Object#timeout has been deprecated a long time ago, use
  Timeout.timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51225 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13 10:07:01 +00:00
nobu 8d7058db47 test_timeout.rb: add an assertion
* test/test_timeout.rb (test_custom_exception): assert that the
  given exception will raise on timeout.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51214 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 23:47:55 +00:00
nobu 0f663b2449 timeout.rb: removed and use Timeout::Error
* lib/timeout.rb (ExitException): removed internal exception class
  and use Timeout::Error instead, as using throw/catch to isolate
  each timeouts now.  [ruby-dev:49179] [Bug #11344]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51213 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10 13:05:53 +00:00
nobu bd77dbc37a test_thread.rb: move thread switch test
* test/ruby/test_thread.rb (test_switch_while_busy_loop): move
  from test/test_timeout.rb.  [Bug #1402]

* test/test_timeout.rb (test_timeout): no longer related to
  [Bug #1402].  [Bug #8523]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-28 03:05:48 +00:00
hsbt 563ee01100 * test/test_timeout.rb (test_timeout): inverted test condition.
[Bug #8523]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-27 08:00:19 +00:00
nobu 3e9e4a6a96 lib/timeout.rb: fallback to Timeout::Error
* lib/timeout.rb (Timeout::ExitException.catch): pass arguments
  for new instance.
* lib/timeout.rb (Timeout::ExitException#exception): fallback to
  Timeout::Error if couldn't throw.  [ruby-dev:47872] [Bug #9380]
* lib/timeout.rb (Timeout#timeout): initialize ExitException with
  message for the fallback case.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-08 04:12:39 +00:00
nobu 97c0aaea71 timeout.rb: fix for ExitException
* lib/timeout.rb (Timeout#timeout): should not rescue ordinarily
  raised ExitException, which should not be thrown.
* lib/timeout.rb (Timeout::ExitException.catch): set @thread only if
  it ought to be caught.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07 03:43:08 +00:00
nobu 9f5537c5b3 timeout.rb: defer creating custom exception
* lib/timeout.rb (Timeout#timeout): when a custom exception is given,
  no instance is needed to be caught, so defer creating new instance
  until it is raised.  [ruby-core:59511] [Bug #9354]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07 03:42:37 +00:00
nobu 765ec40120 test_timeout.rb: shorten waiting times
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07 03:41:24 +00:00
nobu ba57274860 timeout.rb: raise given exception
* lib/timeout.rb (Timeout#timeout): skip rescue clause only when no
  exception class is given.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42710 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27 08:18:50 +00:00
nobu 1a3bcf103c timeout.rb: skip rescue
* lib/timeout.rb (Timeout#timeout): should not be caught by rescue
  clause.  [Bug #8730]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-26 06:27:48 +00:00
kosaki 3bbffbc7dd Revert r38216 and r38221. Release manager mark this feature as "next minor".
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07 10:36:59 +00:00
nobu 08f0db2c68 timeout.rb: replace deferred exception after async_interrupt_timing
* lib/timeout.rb (Timeout#timeout): since async_interrupt_timing
  re-raises a deferred exception, replace the timeout exception with
  Timeout::Error after it.  [Bug #7503]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07 05:04:02 +00:00
kosaki a400c94d72 * lib/timeout.rb (Timeout#timeout): set
async_interrupt_timeing(:on_blocking) by default.
  [Bug #7503] [ruby-core:50524]

* test/test_timeout.rb (#test_timeout_blocking): test for the above.
* test/test_timeout.rb (test_timeout_immediate): ditto
* test/test_timeout.rb (test_timeout_immediate2): ditto.

* NEWS: news for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05 15:04:09 +00:00
nobu 312d5bf7f2 * lib/timeout.rb (Timeout#timeout): propagate errors to the
caller.  [ruby-dev:41010]'


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19 09:58:09 +00:00
kazu f4f3096dd3 test/test_timeout.rb (TestTimeout#test_timeout): add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23302 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-04-28 10:10:05 +00:00
akr 05e52bf46b add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14937 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-01-07 15:32:07 +00:00