From 5d7953f86b7ae164017e2292dfb3c108e0e02527 Mon Sep 17 00:00:00 2001 From: Jeremy Evans Date: Fri, 25 Sep 2020 13:29:20 -0700 Subject: 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] --- dir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'dir.c') diff --git a/dir.c b/dir.c index e5b6705b32..49e6818d25 100644 --- a/dir.c +++ b/dir.c @@ -1024,7 +1024,8 @@ chdir_restore(VALUE v) * block. chdir blocks can be nested, but in a * multi-threaded program an error will be raised if a thread attempts * to open a chdir block while another thread has one - * open. + * open or a call to chdir without a block occurs inside + * a block passed to chdir (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()) { -- cgit v1.2.3