Merge pull request #14792 from shadmansaleh/refactor/mkdir_p

Refactor(tests): Use os commands in mkdir_p helper
This commit is contained in:
Björn Linse 2021-07-01 16:20:34 +02:00 committed by GitHub
commit f133ab598f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 6 deletions

View File

@ -443,10 +443,7 @@ describe('user config init', function()
before_each(function()
rmdir(xhome)
-- TODO, make mkdir_p helper
mkdir(xhome)
mkdir(xconfig)
mkdir(xconfig .. pathsep .. 'nvim')
mkdir_p(xconfig .. pathsep .. 'nvim')
write_file(init_lua_path, [[
vim.g.lua_rc = 1

View File

@ -878,9 +878,11 @@ function module.os_kill(pid)
or 'kill -9 '..pid..' > /dev/null'))
end
-- Create directories with non exsisting intermidiate directories
-- Create folder with non existing parents
function module.mkdir_p(path)
return module.meths.call_function('mkdir', {path, 'p'})
return os.execute((iswin()
and 'mkdir '..path
or 'mkdir -p '..path))
end
module = global_helpers.tbl_extend('error', module, global_helpers)