summaryrefslogtreecommitdiff
path: root/lib/timeout.rb
AgeCommit message (Collapse)Author
2019-06-04Add some documentation to Timeout#timeout about possible issuesJeremy Evans
Documentation requested in [Bug #15886].
2017-12-12Add uplevel keyword to Kernel#warn and use itshyouhei
If uplevel keyword is given, the warning message is prepended with caller file and line information and the string "warning: ". The use of the uplevel keyword makes Kernel#warn format output similar to how rb_warn formats output. This patch modifies net/ftp and net/imap to use Kernel#warn instead of $stderr.puts or $stderr.printf, since they are used for printing warnings. This makes lib/cgi/core and tempfile use $stderr.puts instead of warn for debug logging, since they are used for debug printing and not for warning. This does not modify bundler, rubygems, or rdoc, as those are maintained outside of ruby and probably wish to remain backwards compatible with older ruby versions. rb_warn_m code is originally from nobu, but I've changed it so that it only includes the path and lineno from uplevel (not the method), and also prepends the string "warning: ", to make it more similar to rb_warn. From: Jeremy Evans code@jeremyevans.net Signed-off-by: Urabe Shyouhei shyouhei@ruby-lang.org git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-17Fix typo in `Timeout` doc [ci skip]kazu
Author: yuuji.yaginuma <yuuji.yaginuma@gmail.com> https://github.com/ruby/ruby/pull/1760 [Fix GH-1760] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07fix a typo [ci skip]kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-09-07timeout.rb: custom error messagenobu
* 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
2015-12-18timeout.rb: watcher thread namenobu
* lib/timeout.rb (Timeout#timeout): set watcher thread name to caller location for debugging. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
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-08-13timeout.rb: freeze a string messagenobu
* lib/timeout.rb (Timeout#timeout): freeze a string message to reduce string allocations. [Fix GH-996] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-30variable.c: Module#deprecate_constantnobu
* variable.c (rb_const_get_0): warn deprecated constant reference. * variable.c (rb_mod_deprecate_constant): mark constants to be warned as deprecated. [Feature #11398] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-14timeout.rb: suppress a warningnobu
* lib/timeout.rb (Timeout): get rid of an argument prefix warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13timeout.rb: warn deprecated methodnobu
* lib/timeout.rb (timeout): warn as deprecated for a long time. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51226 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-13timeout.rb: internal constantsnobu
* lib/timeout.rb (Timeout): make internal constants private. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-11timeout.rb: fix backtracenobu
* lib/timeout.rb (Timeout#timeout): remove regexp with wrong line nuber and fix caller depth. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51216 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-10timeout.rb: removed and use Timeout::Errornobu
* 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
2014-11-17timeout.rb: same object across fibernobu
* lib/timeout.rb (Timeout::ExitException.catch): do not freeze the exception for tag, so that the same object can be passed to the target fiber without duplication to attach backtrace at raise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-16timeout.rb: use UncaughtThrowErrornobu
* lib/timeout.rb (Timeout::ExitException#exception): rescue UncaughtThrowError which is specific for throw, instead of ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48460 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-08lib/timeout.rb: fallback to Timeout::Errornobu
* 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-07timeout.rb: revert r44520nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44521 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07timeout.rb: current_targetnobu
* lib/timeout.rb (Timeout::ExitException#target): rename attribute. * lib/timeout.rb (Timeout::ExitException.current_target): extract a method to achieve the target. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44520 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07timeout.rb: unused attributenobu
* lib/timeout.rb (Timeout::ExitException): remove unused attribute, klass. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-07timeout.rb: fix for ExitExceptionnobu
* 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-07timeout.rb: defer creating custom exceptionnobu
* 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
2013-11-10* lib/timeout.rb: Added note about change from #8730 [Fixes GH-440]zzak
* NEWS: Improve grammar on change to Timeout Patched by @srawlins in https://github.com/ruby/ruby/pull/440 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-08-27timeout.rb: raise given exceptionnobu
* 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-26timeout.rb: skip rescuenobu
* 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-03-31doumentation by @toolmantim [GH fixes #270]hsbt
* timeout.rb: Document Timeout::timeout 0 and nil argument behavior git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07Revert r38216 and r38221. Release manager mark this feature as "next minor".kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38260 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-07timeout.rb: replace deferred exception after async_interrupt_timingnobu
* 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-05 * lib/timeout.rb (Timeout#timeout): specify a exceptiontarui
more strictly at async_interrupt_timing. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05adjust style and fix typo and indentkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-05* lib/timeout.rb (Timeout#timeout): setkosaki
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-10-11* lib/timeout.rb (timeout):zzak
Remove paragraph on wrong implementation detail. [ruby-core:47739] [Bug #7088] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37145 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-16 * lib/timeout.rb: Clarify timeout duration types. Patch by Alf Mikula.drbrain
[Ruby 1.9 - Bug #4791] * lib/net/http.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32116 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-22 * lib/timeout.rb: Improve documentation. Patch by David Copeland.drbrain
[Ruby 1.9 - Bug #4755] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-18* lib/timeout.rb (Timeout#timeout): don't leak "execution expired"kosaki
exception. [Bug #4283] [ruby-core:34534]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-16 * lib/timeout.rb (module Timeout): Hide internal constants. Patch bydrbrain
Pete Higgins. [Ruby 1.9 - Bug #4701] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31592 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-04-19* lib/timeout.rb (Timeout#timeout): propagate errors to thenobu
caller. [ruby-dev:41010]' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27395 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-03-11* sample/timeout.rb: split from lib/timeout.rb.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26877 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2009-03-06* {ext,lib,test}/**/*.rb: removed trailing spaces.nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22784 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2008-02-13* lib/timeout.rb (Timeout::timeout): made sensitive to location on thenobu
stack. [ruby-core:15458] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15464 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-12-15* lib/timeout.rb: join the background thread to make sure it is dead.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2007-03-05* lib/timeout.rb (Timeout.timeout): should return the block value always.aamine
* lib/timeout.rb (Timeout.timeout): should yield sec argument always. * lib/timeout.rb (Timeout.timeout): fix document. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2006-12-31 * Merge YARVko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11439 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-11-21Updated rdoc to fix timeout.rb and include rinda directory. By Eric Hodelryan
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@9583 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2005-03-04* array.c: replace rb_protect_inspect() and rb_inspecting_p() bymatz
rb_exec_recursive() in eval.c. * eval.c (rb_exec_recursive): new function. * array.c (rb_ary_join): use rb_exec_recursive(). * array.c (rb_ary_inspect, rb_ary_hash): ditto. * file.c (rb_file_join): ditto. * hash.c (rb_hash_inspect, rb_hash_to_s, rb_hash_hash): ditto. * io.c (rb_io_puts): ditto. * object.c (rb_obj_inspect): ditto * struct.c (rb_struct_inspect): ditto. * lib/set.rb (SortedSet::setup): a hack to shut up warning. [ruby-talk:132866] * lib/time.rb (Time::strptime): add new function. inspired by [ruby-talk:132815]. * lib/parsedate.rb (ParseDate::strptime): ditto. * regparse.c: move st_*_strend() functions from st.c. fixed some potential memory leaks. * exception error messages updated. [ruby-core:04497] * ext/socket/socket.c (Init_socket): add bunch of Socket constants. Patch from Sam Roberts <sroberts@uniserve.com>. [ruby-core:04409] * array.c (rb_ary_s_create): no need for negative argc check. [ruby-core:04463] * array.c (rb_ary_unshift_m): ditto. * lib/xmlrpc/parser.rb (XMLRPC::FaultException): make it subclass of StandardError class, not Exception class. [ruby-core:04429] * parse.y (fcall_gen): lvar(arg) will be evaluated as lvar.call(arg) when lvar is a defined local variable. [new] * object.c (rb_class_initialize): call inherited method before calling initializing block. * eval.c (rb_thread_start_1): initialize newly pushed frame. * lib/open3.rb (Open3::popen3): $? should not be EXIT_FAILURE. fixed: [ruby-core:04444] * eval.c (is_defined): NODE_IASGN is an assignment. * ext/readline/readline.c (Readline.readline): use rl_outstream and rl_instream. [ruby-dev:25699] * ext/etc/etc.c (Init_etc): sGroup needs HAVE_ST_GR_PASSWD check [ruby-dev:25675] * misc/ruby-mode.el: [ruby-core:04415] * lib/rdoc/generators/html_generator.rb: [ruby-core:04412] * lib/rdoc/generators/ri_generator.rb: ditto. * struct.c (make_struct): fixed: [ruby-core:04402] * ext/curses/curses.c (window_color_set): [ruby-core:04393] * ext/socket/socket.c (Init_socket): SO_REUSEPORT added. [ruby-talk:130092] * object.c: [ruby-doc:818] * parse.y (open_args): fix too verbose warnings for the space before argument parentheses. [ruby-dev:25492] * parse.y (parser_yylex): ditto. * parse.y (parser_yylex): the first expression in the parentheses should not be a command. [ruby-dev:25492] * lib/irb/context.rb (IRB::Context::initialize): [ruby-core:04330] * object.c (Init_Object): remove Object#type. [ruby-core:04335] * st.c (st_foreach): report success/failure by return value. [ruby-Bugs-1396] * parse.y: forgot to initialize parser struct. [ruby-dev:25492] * parse.y (parser_yylex): no tLABEL on EXPR_BEG. [ruby-talk:127711] * document updates - [ruby-core:04296], [ruby-core:04301], [ruby-core:04302], [ruby-core:04307] * dir.c (rb_push_glob): should work for NUL delimited patterns. * dir.c (rb_glob2): should aware of offset in the pattern. * string.c (rb_str_new4): should propagate taintedness. * env.h: rename member names in struct FRAME; last_func -> callee, orig_func -> this_func, last_class -> this_class. * struct.c (rb_struct_set): use original method name, not callee name, to retrieve member slot. [ruby-core:04268] * time.c (time_strftime): protect from format modification from GC finalizers. * object.c (Init_Object): remove rb_obj_id_obsolete() * eval.c (rb_mod_define_method): incomplete subclass check. [ruby-dev:25464] * gc.c (rb_data_object_alloc): klass may be NULL. [ruby-list:40498] * bignum.c (rb_big_rand): should return positive random number. [ruby-dev:25401] * bignum.c (rb_big_rand): do not use rb_big_modulo to generate random bignums. [ruby-dev:25396] * variable.c (rb_autoload): [ruby-dev:25373] * eval.c (svalue_to_avalue): [ruby-dev:25366] * string.c (rb_str_justify): [ruby-dev:25367] * io.c (rb_f_select): [ruby-dev:25312] * ext/socket/socket.c (sock_s_getservbyport): [ruby-talk:124072] * struct.c (make_struct): [ruby-dev:25249] * dir.c (dir_open_dir): new function. [ruby-dev:25242] * io.c (rb_f_open): add type check for return value from to_open. * lib/pstore.rb (PStore#transaction): Use the empty content when a file is not found. [ruby-dev:24561] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@8068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-07-14* enum.c (enum_min_by): new method Enum#min_by. added Enum#max_bymatz
as well. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6629 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2004-04-18* dln.c, io.c, pack.c, lib/benchmark.rb, lib/cgi.rb, lib/csv.rb,nobu
lib/date.rb, lib/ftools.rb, lib/getoptlong.rb, lib/logger.rb, lib/matrix.rb, lib/monitor.rb, lib/set.rb, lib/thwait.rb, lib/timeout.rb, lib/yaml.rb, lib/drb/drb.rb, lib/irb/workspace.rb, lib/net/ftp.rb, lib/net/http.rb, lib/net/imap.rb, lib/net/pop.rb, lib/net/telnet.rb, lib/racc/parser.rb, lib/rinda/rinda.rb, lib/rinda/tuplespace.rb, lib/shell/command-processor.rb, lib/soap/rpc/soaplet.rb, lib/test/unit/testcase.rb, lib/test/unit/testsuite.rb: typo fix. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6178 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-29* marshal.c (w_object): if object responds to 'marshal_dump',matz
Marshal.dump uses it to dump object. unlike '_dump', marshal_dump returns any kind of object. * marshal.c (r_object0): restore instance by calling 'marshal_load' method. unlike '_load', it's an instance method, to handle cyclic reference. * marshal.c (marshal_load): all objects read from file should be tainted. [ruby-core:01325] * lib/timeout.rb (Timeout::timeout): execute immediately if sec is zero. * ext/socket/socket.c (socks_init): typo fixed. [ruby-talk:77232] * ext/socket/extconf.rb: the default value for --enable-socks is taken from ENV["SOCKS_SERVER"]. [ruby-talk:77232] * ruby.c (proc_options): add -W option. -W0 to shut up all warning messages. [ruby-talk:77227] * error.c (rb_warn): no message will be printed if the value of $VERBOSE is "nil", i.e. perfect silence. * ruby.c (verbose_setter): $VERBOSE value is either true, false, or nil. * io.c (Init_IO): no "read" check for $stdin. in addition some function names has been changed. * regex.c (re_match_exec): incorrect multibyte match. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-03* lib/timeout.rb: add optional exception argument for compatibilityakr
function. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2003-07-03* array.c (rb_values_at): extract common procedure frommatz
rb_ary_values_at. follow DRY principle. * re.c (match_values_at): values_at should understand ranges. * struct.c (rb_struct_values_at): ditto. * struct.c (inspect_struct): inspect format changed; add "struct " at the top. * sprintf.c (rb_f_sprintf): "%p" specifier for inspect output. (RCR#68) * eval.c (rb_mod_undef_method): allow "undef_method" to accept multiple arguments. (RCR#146) * lib/timeout.rb: put timeout in Timeout module. (RCR#121) [ruby-talk:61028] * re.c (match_groups): new method added. (RCR#139) * variable.c (rb_mod_const_of): should exclude constant defined in Object, unless retrieving constants of Object. * string.c (rb_str_new4): do not allocate new string if original is frozen or already have copy-on-write entry. [ruby-talk:74940] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e