patch 8.0.0492: a failing client-server request can make Vim hang
Problem: A failing client-server request can make Vim hang.
Solution: Add a timeout argument to functions that wait.
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 0387e32..5fa31a2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -6320,15 +6320,17 @@
{only available when compiled with the |+reltime| feature}
*remote_expr()* *E449*
-remote_expr({server}, {string} [, {idvar}])
+remote_expr({server}, {string} [, {idvar} [, {timeout}]])
Send the {string} to {server}. The string is sent as an
expression and the result is returned after evaluation.
The result must be a String or a |List|. A |List| is turned
into a String by joining the items with a line break in
between (not at the end), like with join(expr, "\n").
- If {idvar} is present, it is taken as the name of a
- variable and a {serverid} for later use with
+ If {idvar} is present and not empty, it is taken as the name
+ of a variable and a {serverid} for later use with
remote_read() is stored there.
+ If {timeout} is given the read times out after this many
+ seconds. Otherwise a timeout of 600 seconds is used.
See also |clientserver| |RemoteReply|.
This function is not available in the |sandbox|.
{only available when compiled with the |+clientserver| feature}
@@ -6367,9 +6369,10 @@
:let repl = ""
:echo "PEEK: ".remote_peek(id, "repl").": ".repl
-remote_read({serverid}) *remote_read()*
+remote_read({serverid}, [{timeout}]) *remote_read()*
Return the oldest available reply from {serverid} and consume
- it. It blocks until a reply is available.
+ it. Unless a {timeout} in seconds is given, it blocks until a
+ reply is available.
See also |clientserver|.
This function is not available in the |sandbox|.
{only available when compiled with the |+clientserver| feature}