diff options
| author | William Boman <william@redwill.se> | 2021-09-10 13:45:20 +0200 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2021-09-10 13:45:20 +0200 |
| commit | 6ee0d8f802532a128328cbea91b3b3b5d752c528 (patch) | |
| tree | 0603743120097ea9e50843da0df2175d4a49bb92 /lua | |
| parent | rewrite some installers for broader cross-platform support (#85) (diff) | |
| download | mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar.gz mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar.bz2 mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar.lz mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar.xz mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.tar.zst mason-6ee0d8f802532a128328cbea91b3b3b5d752c528.zip | |
installers/std: always delete file after unzip/untar
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/std.lua | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/lua/nvim-lsp-installer/installers/std.lua b/lua/nvim-lsp-installer/installers/std.lua index 0a4aa40a..118d1624 100644 --- a/lua/nvim-lsp-installer/installers/std.lua +++ b/lua/nvim-lsp-installer/installers/std.lua @@ -19,15 +19,18 @@ function M.download_file(url, out_file) end function M.unzip(file, dest) - return installers.when { - unix = function(server, callback, context) - process.spawn("unzip", { - args = { "-d", dest, file }, - cwd = server.root_dir, - stdio_sink = context.stdio_sink, - }, callback) - end, - win = shell.powershell(("Expand-Archive -Path %q -DestinationPath %q"):format(file, dest)), + return installers.pipe { + installers.when { + unix = function(server, callback, context) + process.spawn("unzip", { + args = { "-d", dest, file }, + cwd = server.root_dir, + stdio_sink = context.stdio_sink, + }, callback) + end, + win = shell.powershell(("Expand-Archive -Path %q -DestinationPath %q"):format(file, dest)), + }, + installers.always_succeed(M.delete_file, file), } end @@ -35,7 +38,6 @@ function M.unzip_remote(url, dest) return installers.pipe { M.download_file(url, "archive.zip"), M.unzip("archive.zip", dest or "."), - installers.always_succeed(M.delete_file "archive.zip"), } end @@ -57,7 +59,6 @@ function M.untargz_remote(url) M.download_file(url, "archive.tar.gz"), M.gunzip "archive.tar.gz", M.untar "archive.tar", - installers.always_succeed(M.delete_file "archive.tar"), } end |
