extend/fileutils: fix monkeypatch.

Otherwise using the options argument or relying on a result means this
method will fail. This is why monkeypatching sucks.

CC @reitermarkus as we've talked about monkeypatching recently.
This commit is contained in:
Mike McQuaid 2018-07-13 08:05:33 +01:00
parent e1eb7dd3e3
commit c3f8ffbb10

View File

@ -86,9 +86,9 @@ module FileUtils
alias old_mkdir mkdir
# A version of mkdir that also changes to that folder in a block.
def mkdir(name, &_block)
mkdir_p(name)
return unless block_given?
def mkdir(name, mode: nil, noop: nil, verbose: nil, &_block)
result = mkdir_p(name, mode: mode, noop: noop, verbose: verbose)
return result unless block_given?
chdir name do
yield
end