changeset 25088:5f6a70167daa v8.2.3081

patch 8.2.3081: cannot catch errors in a channel command Commit: https://github.com/vim/vim/commit/11a632d60bde616feb298d180108819ebb1d04a0 Author: Alisue <lambdalisue@hashnote.net> Date: Wed Jun 30 22:01:02 2021 +0200 patch 8.2.3081: cannot catch errors in a channel command Problem: Cannot catch errors in a channel command. Solution: Instead of skipping the error make it silent. (closes https://github.com/vim/vim/issues/8477)
author Bram Moolenaar <Bram@vim.org>
date Wed, 30 Jun 2021 22:15:03 +0200
parents 49075d646117
children 80739b453fd4
files src/channel.c src/version.c
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -2545,7 +2545,8 @@ channel_exe_cmd(channel_T *channel, ch_p
 	    char_u	*json = NULL;
 
 	    // Don't pollute the display with errors.
-	    ++emsg_skip;
+	    // Do generate the errors so that try/catch works.
+	    ++emsg_silent;
 	    if (!is_call)
 	    {
 		ch_log(channel, "Evaluating expression '%s'", (char *)arg);
@@ -2581,7 +2582,7 @@ channel_exe_cmd(channel_T *channel, ch_p
 		    vim_free(json);
 		}
 	    }
-	    --emsg_skip;
+	    --emsg_silent;
 	    if (tv == &res_tv)
 		clear_tv(tv);
 	    else
--- a/src/version.c
+++ b/src/version.c
@@ -756,6 +756,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3081,
+/**/
     3080,
 /**/
     3079,