summaryrefslogtreecommitdiff
path: root/modules/ssh/dist
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2017-06-15 14:55:10 +0200
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-06-16 22:48:47 +0300
commitc63cfa4cb9e1e80c633d219cae1cb7e3d7900933 (patch)
treee2753ab2df679fe481f844fb480b8f3f32ad3a1e /modules/ssh/dist
parentsession-func.c (guile_ssh_session_set): Throw an option with its value (diff)
downloadguile-ssh-c63cfa4cb9e1e80c633d219cae1cb7e3d7900933.tar.gz
node.scm (node-eval): Always close the REPL channel.
* modules/ssh/dist/node.scm (node-eval): Use 'dynamic-wind' to systematically close REPL-CHANNEL. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com>
Diffstat (limited to 'modules/ssh/dist')
-rw-r--r--modules/ssh/dist/node.scm17
1 files changed, 12 insertions, 5 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 163fb72..09ce794 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -391,11 +391,18 @@ listens on an expected port, return #f otherwise."
"Evaluate QUOTED-EXP on the node and return the evaluated result."
(let ((repl-channel (node-open-rrepl node)))
(rrepl-skip-to-prompt repl-channel)
- (call-with-values (lambda () (rrepl-eval repl-channel quoted-exp))
- (lambda vals
- (and (node-stop-repl-server? node)
- (node-stop-server node))
- (apply values vals)))))
+ (dynamic-wind
+ (const #t)
+ (lambda ()
+ (rrepl-eval repl-channel quoted-exp))
+ (lambda ()
+ (when (node-stop-repl-server? node)
+ (node-stop-server node))
+
+ ;; Close REPL-CHANNEL right away to prevent finalization from
+ ;; happening in another thread at the wrong time (see
+ ;; <https://bugs.gnu.org/26976>.)
+ (close-port repl-channel)))))
(define (node-eval-1 node quoted-exp)
"Evaluate QUOTED-EXP on the node and return the evaluated result. The