diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2024-03-05 22:02:03 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2024-03-06 06:50:17 +0000 |
commit | 2725e46dcb9d2c56ae070e2d68ccbf3cd02a3d59 (patch) | |
tree | f275a8fc5a07ef68823d78f6dc5c6407aa4c1d81 | |
parent | 6662898679d15b7e361b4de1f5cdda4a7656b35b (diff) | |
download | luarocks-2725e46dcb9d2c56ae070e2d68ccbf3cd02a3d59.tar.gz luarocks-2725e46dcb9d2c56ae070e2d68ccbf3cd02a3d59.tar.bz2 luarocks-2725e46dcb9d2c56ae070e2d68ccbf3cd02a3d59.zip |
fs(windows): avoid excessive icacls calls
-rw-r--r-- | src/luarocks/fs/lua.lua | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/luarocks/fs/lua.lua b/src/luarocks/fs/lua.lua index 454d8e46..6e8c4670 100644 --- a/src/luarocks/fs/lua.lua +++ b/src/luarocks/fs/lua.lua | |||
@@ -472,7 +472,8 @@ function fs_lua.copy(src, dest, perms) | |||
472 | while true do | 472 | while true do |
473 | local block = src_h:read(8192) | 473 | local block = src_h:read(8192) |
474 | if not block then break end | 474 | if not block then break end |
475 | dest_h:write(block) | 475 | local ok, err = dest_h:write(block) |
476 | if not ok then return nil, err end | ||
476 | end | 477 | end |
477 | src_h:close() | 478 | src_h:close() |
478 | dest_h:close() | 479 | dest_h:close() |
@@ -484,10 +485,14 @@ function fs_lua.copy(src, dest, perms) | |||
484 | if fullattrs and posix_ok then | 485 | if fullattrs and posix_ok then |
485 | return posix.chmod(dest, fullattrs) | 486 | return posix.chmod(dest, fullattrs) |
486 | else | 487 | else |
487 | if not perms then | 488 | if cfg.is_platform("unix") then |
488 | perms = fullattrs:match("x") and "exec" or "read" | 489 | if not perms then |
490 | perms = fullattrs:match("x") and "exec" or "read" | ||
491 | end | ||
492 | return fs.set_permissions(dest, perms, "all") | ||
493 | else | ||
494 | return true | ||
489 | end | 495 | end |
490 | return fs.set_permissions(dest, perms, "all") | ||
491 | end | 496 | end |
492 | end | 497 | end |
493 | 498 | ||