@@ -18,19 +18,37 @@ return {
1818 return
1919 end
2020 check_item = check_item or " config"
21- jobrunner .run_async ({ " check" , check_item }, function (result , error , code , signal )
22- local out = {
23- stdout = table.concat (vim .iter (result ):flatten (math.huge ):totable ()),
24- stderr = table.concat (vim .iter (error ):flatten (math.huge ):totable ()),
25- code = code ,
26- signal = signal ,
27- }
28- if out .code == 0 and type (on_success ) == " function" then
29- vim .schedule_wrap (on_success )(out )
30- elseif out .code ~= 0 and type (on_failure ) == " function" then
31- vim .schedule_wrap (on_failure )(out )
32- end
33- end , 0 )
21+ jobrunner .run_async (
22+ { " check" , check_item },
23+ function (result , _error , code , signal )
24+ local out_msg = nil
25+ if type (result ) == " table" and # result > 0 then
26+ out_msg = table.concat (vim .iter (result ):flatten (math.huge ):totable ())
27+ elseif type (result ) == " string" then
28+ out_msg = result
29+ end
30+
31+ local err_msg = nil
32+ if type (_error ) == " table" and # _error > 0 then
33+ err_msg = table.concat (vim .iter (_error ):flatten (math.huge ):totable ())
34+ elseif type (_error ) == " string" then
35+ out_msg = _error
36+ end
37+
38+ local out = {
39+ stdout = out_msg ,
40+ stderr = err_msg ,
41+ code = code ,
42+ signal = signal ,
43+ }
44+ if out .code == 0 and type (on_success ) == " function" then
45+ vim .schedule_wrap (on_success )(out )
46+ elseif out .code ~= 0 and type (on_failure ) == " function" then
47+ vim .schedule_wrap (on_failure )(out )
48+ end
49+ end ,
50+ 0
51+ )
3452 end ,
3553 },
3654}
0 commit comments