diff options
author | Jeremy Evans <code@jeremyevans.net> | 2020-09-25 13:29:20 -0700 |
---|---|---|
committer | Jeremy Evans <code@jeremyevans.net> | 2020-09-28 08:34:04 -0700 |
commit | 5d7953f86b7ae164017e2292dfb3c108e0e02527 (patch) | |
tree | 48704c5ec68cb37b0df17eca58c3660d826d765c /dir.c | |
parent | 0164ac70a14c3cc17989d76959cf791ec22e8695 (diff) |
Switch conflicting chdir warning to RuntimeError
The documentation already stated this was an error in one case
(when it was previously a warning). Describe the other case,
where chdir without block is called inside block passed to chdir.
Fixes [Bug #15661]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3591
Diffstat (limited to 'dir.c')
-rw-r--r-- | dir.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1024,7 +1024,8 @@ chdir_restore(VALUE v) * block. <code>chdir</code> blocks can be nested, but in a * multi-threaded program an error will be raised if a thread attempts * to open a <code>chdir</code> block while another thread has one - * open. + * open or a call to <code>chdir</code> without a block occurs inside + * a block passed to <code>chdir</code> (even in the same thread). * * Dir.chdir("/var/spool/mail") * puts Dir.pwd @@ -1064,7 +1065,7 @@ dir_s_chdir(int argc, VALUE *argv, VALUE obj) if (chdir_blocking > 0) { if (!rb_block_given_p() || rb_thread_current() != chdir_thread) - rb_warn("conflicting chdir during another chdir block"); + rb_raise(rb_eRuntimeError, "conflicting chdir during another chdir block"); } if (rb_block_given_p()) { |