summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2018-03-08 18:48:12 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2018-03-08 18:48:12 +0300
commite7901f5f05edfb7684dfc0e783cee134ffce57b5 (patch)
treed5a9526924871aa95a4d78e1c4eb8968fde76c5a /modules
parentnode.scm (node-run-server): Check return code (diff)
downloadguile-ssh-e7901f5f05edfb7684dfc0e783cee134ffce57b5.tar.gz
node.scm: Improve error handling
* modules/ssh/dist/node.scm: Improve error handling: throw an error with the current node and the error code from the server. Log errors to the main log. * doc/api-dist.texi: Update.
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/dist/node.scm13
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 9ff3750..85867f7 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -352,11 +352,16 @@ listens on an expected port, return #f otherwise."
(define %guile-listen-command "nohup guile --listen=~a 0<&- &>/dev/null")
(define (node-run-server node)
- "Run a RREPL server on a NODE. Throw 'node-error on an error."
+ "Run a RREPL server on a NODE. Throw 'node-error' with the current node and
+the Guile return code from a server on an error."
(let* ((cmd (format #f %guile-listen-command (node-repl-port node)))
- (channel (open-remote-input-pipe (node-session node) cmd)))
- (when (not (zero? (channel-get-exit-status channel)))
- (node-error "node-run-server: Could not execute command" cmd))
+ (channel (open-remote-input-pipe (node-session node) cmd))
+ (rc (channel-get-exit-status channel)))
+ (format-log 'functions "[scm] node-run-server"
+ "commmand: '~a'; return code: ~a" cmd rc)
+ (when (not (zero? rc))
+ (node-error "node-run-server: Could not run a RREPL server"
+ node rc))
(while (not (node-server-running? node))
(usleep 100))))