@@ -206,12 +206,10 @@ end
206206
207207function M .exe (cmd , opts )
208208 return Promise .new (function (resolve )
209- local stdin = uv .new_pipe ()
210- local stdout = uv .new_pipe ()
211- local stderr = uv .new_pipe ()
212- opts .stdio = { stdin , stdout , stderr }
213- uv .spawn (cmd , opts , function (code )
214- resolve (code )
209+ vim .system (utils .concat ({ cmd }, opts .args or {}), {
210+ cwd = opts .cwd ,
211+ }, function (result )
212+ resolve (result .code , result .stderr )
215213 end )
216214 end )
217215end
@@ -272,9 +270,9 @@ function M.get_path(url, type)
272270 utils .notify ((' %s tree-sitter grammar...' ):format (msg [type ]), { id = ' orgmode-treesitter-install' })
273271 return M .exe (' git' , {
274272 args = { ' clone' , ' --filter=blob:none' , ' --depth=1' , ' --branch=' .. required_version , url , path },
275- }):next (function (code )
273+ }):next (function (code , err )
276274 if code ~= 0 then
277- error (' [orgmode] Failed to clone tree-sitter-org' , 0 )
275+ error (' [orgmode] Failed to clone tree-sitter-org: ' .. ( tostring ( err ) or ' Unknown error ' ) , 0 )
278276 end
279277 return path
280278 end )
@@ -305,16 +303,20 @@ function M.run(type)
305303 cwd = directory ,
306304 })
307305 end )
308- :next (function (code )
306+ :next (function (code , err )
309307 if code ~= 0 then
310- error (' [orgmode] Failed to compile parser' , 0 )
308+ error (' [orgmode] Failed to compile parser: ' .. ( tostring ( err ) or ' Unknown error ' ) , 0 )
311309 end
312310 local move_cmd = M .select_mv_cmd (' parser.so' , M .get_parser_path (), ts_grammar_dir or ' ' , is_win , shellslash )
313311 return M .exe (move_cmd .cmd , move_cmd .opts )
314312 end )
315- :next (function (code )
313+ :next (function (code , err )
316314 if code ~= 0 then
317- error (' [orgmode] Failed to move generated tree-sitter parser to runtime folder' , 0 )
315+ error (
316+ ' [orgmode] Failed to move generated tree-sitter parser to runtime folder: '
317+ .. (tostring (err ) or ' Unknown error' ),
318+ 0
319+ )
318320 end
319321 return M ._write_lock_file ({ version = required_version })
320322 end )
0 commit comments