mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
dir.c: chdir conflict should raise only when called in different thread
... and keep it as a warning (like 2.7) when it is called in the same thread. [Bug #15661]
This commit is contained in:
parent
e43b5aa52d
commit
8e1c0b2f93
Notes:
git
2020-12-24 14:35:05 +09:00
2 changed files with 19 additions and 4 deletions
|
@ -97,9 +97,22 @@ class TestDir < Test::Unit::TestCase
|
|||
assert_raise(ArgumentError) { Dir.chdir }
|
||||
ENV["HOME"] = pwd
|
||||
Dir.chdir do
|
||||
assert_equal(pwd, Dir.pwd)
|
||||
assert_raise(RuntimeError) { Dir.chdir(@root) }
|
||||
assert_equal(pwd, Dir.pwd)
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(pwd) }
|
||||
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(@root) }
|
||||
assert_equal(@root, Dir.pwd)
|
||||
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(pwd) }
|
||||
|
||||
assert_raise(RuntimeError) { Thread.new { Thread.current.report_on_exception = false; Dir.chdir(@root) }.join }
|
||||
assert_raise(RuntimeError) { Thread.new { Thread.current.report_on_exception = false; Dir.chdir(@root) { } }.join }
|
||||
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(pwd) }
|
||||
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(@root) }
|
||||
assert_equal(@root, Dir.pwd)
|
||||
|
||||
assert_warning(/conflicting chdir during another chdir block/) { Dir.chdir(pwd) }
|
||||
Dir.chdir(@root) do
|
||||
assert_equal(@root, Dir.pwd)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue