merge revision(s) 2ecfb88ee5: [Backport #16918]

Correctly remove temporary directory if path yielded is mutated

	Another approach would be to freeze the string, but that could
	cause backwards compatibility issues.

	Fixes [Bug #16918]
This commit is contained in:
nagachika 2020-07-23 11:16:31 +09:00
parent cc39480cf9
commit 13d2ab0d88
3 changed files with 13 additions and 2 deletions

View file

@ -86,7 +86,7 @@ class Dir
}
if block_given?
begin
yield path
yield path.dup
ensure
unless base
stat = File.stat(File.dirname(path))