11-- NOTE: copied from
2- -- https://github.com/neovim/neovim/blob/909b18d05a8d472b12c156e1663282bf6f5ce307 /runtime/lua/vim/_system.lua
2+ -- https://github.com/neovim/neovim/blob/4369d7d9a7804b8f9c2254da9f153d428115334a /runtime/lua/vim/_system.lua
33
44--- @diagnostic disable
55local uv = vim .uv
@@ -140,18 +140,18 @@ function SystemObj:is_closing()
140140 return handle == nil or handle :is_closing () or false
141141end
142142
143- --- @param output ? uv.read_start.callback | false
143+ --- @param output ? fun ( err : string ?, data : string ?) |false
144144--- @param text ? boolean
145145--- @return uv.uv_stream_t ? pipe
146- --- @return uv.read_start.callback ? handler
146+ --- @return fun ( err : string ?, data : string ?) ? handler
147147--- @return string[] ? data
148148local function setup_output (output , text )
149149 if output == false then
150150 return
151151 end
152152
153153 local bucket --- @type string[] ?
154- local handler --- @type uv.read_start.callback
154+ local handler --- @type fun ( err : string ?, data : string ?)
155155
156156 if type (output ) == ' function' then
157157 handler = output
@@ -171,7 +171,8 @@ local function setup_output(output, text)
171171
172172 local pipe = assert (uv .new_pipe (false ))
173173
174- --- @type uv.read_start.callback
174+ --- @param err ? string
175+ --- @param data ? string
175176 local function handler_with_close (err , data )
176177 handler (err , data )
177178 if data == nil then
@@ -249,7 +250,7 @@ local function spawn(cmd, opts, on_exit, on_error)
249250 local handle , pid_or_err = uv .spawn (cmd , opts , on_exit )
250251 if not handle then
251252 on_error ()
252- error (pid_or_err )
253+ error (( ' %s: "%s" ' ): format ( pid_or_err , cmd ) )
253254 end
254255 return handle , pid_or_err --[[ @as integer]]
255256end
0 commit comments