From 3b89fee24632cfddbff5714a509c1c3b72a235c5 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Thu, 11 Nov 2021 09:34:23 +0800 Subject: fix(channel): throw error if sending to internal channel w/o terminal Prevent SIGABRT when sending to a channel created by nvim_open_term() after the associated terminal has been deleted. --- test/functional/core/channels_spec.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/functional/core/channels_spec.lua b/test/functional/core/channels_spec.lua index 93dec9fb35..e5ded6428f 100644 --- a/test/functional/core/channels_spec.lua +++ b/test/functional/core/channels_spec.lua @@ -281,4 +281,14 @@ describe('channels', function() -- works correctly with no output eq({"notification", "exit", {id, 1, {''}}}, next_msg()) end) + + it('should throw error when writing to a channel associated with a deleted terminal', function() + source([[ + let id = nvim_open_term(0, {}) + bdelete! + let v:errmsg = '' + silent! call chansend(id, 'test') + ]]) + eq("Can't send data to closed stream", eval('v:errmsg')) + end) end) -- cgit