Loading ...
Sorry, an error occurred while loading the content.

68638Re: Problem with --remote-expr and error checking

Expand Messages
  • Christian Brabandt
    Mar 9, 2013
    • 0 Attachment
      Hi Андрей!

      On Sa, 09 Mär 2013, Андрей Радев wrote:

      > While trying to evaluate commands on a remote server and get their
      > output, I've ran into a problem with error checking -- it seems like
      > with remote-expr there's no error-checking at all.
      > The simplest example I can think of is this (gist:
      > https://gist.github.com/AndrewRadev/5123706):
      > function! Test()
      > try
      > exe "frobble"
      > return 1
      > catch
      > return 2
      > endtry
      > endfunction
      > If I open a Vim with `vim --servername FOO` and :source this file,
      > executing `:echo Test()` results in 2, since there is no "frobble"
      > command. However, if I then try `vim --servername FOO --remote-expr
      > 'Test()'`, I get 1. I tried avoiding try/catch and using `v:errmsg`
      > instead, but that variable is also not set to the last error if the
      > function is invoked with `--remote-expr`.

      This happens, because error handling is explicitly disabled at
      eval_client_expr_to_string() in main.c

      I think, we can at least enable exception handling by this

      --- a/src/message.c
      +++ b/src/message.c
      @@ -587,7 +587,13 @@

      /* Skip this if not giving error messages at the moment. */
      if (emsg_not_now())
      + {
      +#ifdef FEAT_EVAL
      + /* make sure, exceptions are thrown and handled nevertheless */
      + cause_errthrow(s, emsg_severe, &ignore);
      return TRUE;
      + }

      called_emsg = TRUE;
      ex_exitval = 1;


      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php

      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 6 messages in this topic