diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2025-01-03 18:39:42 +0100 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2025-01-03 19:24:04 +0100 |
commit | 700a25e6218e016b5adb0ddee740be4618d717a2 (patch) | |
tree | 7d068e82e41e44e3325fef63a6a7342234dc900a /test/client/uv_stream.lua | |
parent | a1ba655dee0f89230ea09712e4df981cc3b15bea (diff) | |
download | rneovim-700a25e6218e016b5adb0ddee740be4618d717a2.tar.gz rneovim-700a25e6218e016b5adb0ddee740be4618d717a2.tar.bz2 rneovim-700a25e6218e016b5adb0ddee740be4618d717a2.zip |
test: include stderr in EOF failure message
Diffstat (limited to 'test/client/uv_stream.lua')
-rw-r--r-- | test/client/uv_stream.lua | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/test/client/uv_stream.lua b/test/client/uv_stream.lua index ac84cbf9bc..a9ef2db115 100644 --- a/test/client/uv_stream.lua +++ b/test/client/uv_stream.lua @@ -127,9 +127,11 @@ end --- @field private _child_stdout uv.uv_pipe_t --- @field private _child_stderr uv.uv_pipe_t --- @field stdout string +--- stderr is always collected in this field, regardless of `collect_output`. --- @field stderr string --- @field stdout_eof boolean --- @field stderr_eof boolean +--- Collects stdout in the `stdout` field, and stdout+stderr in `output` field. --- @field private collect_output boolean --- Exit code --- @field status integer @@ -149,8 +151,6 @@ function ProcStream.spawn(argv, env, io_extra) output = '', stdout = '', stderr = '', - stdout_error = nil, -- TODO: not used, remove - stderr_error = nil, -- TODO: not used, remove stdout_eof = false, stderr_eof = false, _child_stdin = assert(uv.new_pipe(false)), @@ -189,14 +189,16 @@ end function ProcStream:on_read(stream, cb, err, chunk) if err then - -- stderr_error/stdout_error - self[stream .. '_error'] = err ---@type string - -- error(err) + error(err) -- stream read failed? elseif chunk then - -- 'stderr' or 'stdout' + -- Always collect stderr, in case it gives useful info on failure. + if stream == 'stderr' then + self.stderr = self.stderr .. chunk ---@type string + end + -- Collect stdout if `collect_output` is enabled. if self.collect_output then - self[stream] = self[stream] .. chunk ---@type string - --- Collects both stdout + stderr. + self.stdout = self.stdout .. chunk ---@type string + --- Collect both stdout + stderr in the `output` field. self.output = self[stream] .. chunk ---@type string end else |