From ef3a7d052c7914cf6844de58367c3a2b8cd91907 Mon Sep 17 00:00:00 2001 From: uga-rosa Date: Wed, 10 Apr 2024 13:46:31 +0900 Subject: [PATCH 1/2] Synchronous external command execution independent of shell #130 --- plugin/jetpack.vim | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/plugin/jetpack.vim b/plugin/jetpack.vim index cdeeb08..4e64dc1 100644 --- a/plugin/jetpack.vim +++ b/plugin/jetpack.vim @@ -160,6 +160,10 @@ if has('nvim') \ 'on_exit': { _, st -> st != 0 ? execute("echoerr '`'.join(a:cmd, ' ').'`:'.join(buf, '')") : a:cb(join(buf, '')) } \ }) endfunction + + function! jetpack#system(cmd) abort + return a:cmd->split(" ")->system() + endfunction else function! jetpack#jobstart(cmd, cb) abort let buf = [] @@ -171,6 +175,15 @@ else \ 'exit_cb': function('jetpack#nvim_exit_cb', [a:cmd, buf, a:cb]) \ }) endfunction + + function! jetpack#system(cmd) abort + let buf = [] + let job = job_start(a:cmd, { + \ 'out_cb': { _, data -> extend(buf, split(data, "\n")) } + \}) + call jetpack#jobwait([job], 0) + return buf->join("\n") + endfunction endif function! jetpack#initialize_buffer() abort @@ -235,8 +248,8 @@ function! jetpack#clean_plugins() abort continue endif if isdirectory(pkg.path) - call system(printf('git -C %s reset --hard', pkg.path)) - let branch = trim(system(printf('git -C %s rev-parse --abbrev-ref %s', pkg.path, pkg.commit))) + call jetpack#system(printf('git -C %s reset --hard', pkg.path)) + let branch = trim(jetpack#system(printf('git -C %s rev-parse --abbrev-ref %s', pkg.path, pkg.commit))) if v:shell_error && !empty(pkg.commit) call delete(pkg.path, 'rf') continue @@ -356,7 +369,7 @@ function! jetpack#download_plugins() abort call add(jobs, job) call jetpack#jobwait(jobs, g:jetpack_njobs) else - let pkg.output = join(map(cmds, { _, cmd -> system(cmd) }), "\n") + let pkg.output = join(map(cmds, { _, cmd -> jetpack#system(cmd) }), "\n") call add(pkg.status, status) endif endfor @@ -378,7 +391,7 @@ function! jetpack#switch_plugins() abort else call add(pkg.status, s:status.switched) endif - call system(printf('git -C %s checkout %s', pkg.path, pkg.commit)) + call jetpack#system(printf('git -C %s checkout %s', pkg.path, pkg.commit)) endfor endfunction @@ -395,7 +408,7 @@ function! jetpack#postupdate_plugins() abort if pkg.do =~# '^:' execute pkg.do else - call system(pkg.do) + call jetpack#system(pkg.do) endif endif call chdir(pwd) From cd443b5cb36f47351e88e825ead2fa565b4f92f8 Mon Sep 17 00:00:00 2001 From: uga-rosa Date: Wed, 10 Apr 2024 22:51:06 +0900 Subject: [PATCH 2/2] use gh-actions-lua --- .github/workflows/test.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 57e1a66..a0a16ee 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,12 +18,10 @@ jobs: - name: Clone vim-jetpack uses: actions/checkout@v3 + - uses: ilammy/msvc-dev-cmd@v1 - name: Install Lua + uses: leafo/gh-actions-lua@v10 if: ${{ contains(matrix.os, 'windows') }} - run: | - Invoke-WebRequest -Uri https://joedf.ahkscript.org/LuaBuilds/hdata/lua-5.4.4_Win64_bin.zip -OutFile .\Lua.zip - Expand-Archive .\Lua.zip C:\Lua - Add-Content $env:GITHUB_PATH C:\Lua - name: Install vim-themis uses: actions/checkout@v3