From e24401f1ef56b1f3d7ef847c54fb0c2fe9cf3cf8 Mon Sep 17 00:00:00 2001 From: "Artyom V. Poptsov" Date: Mon, 5 Mar 2018 05:11:45 +0300 Subject: node.scm (node-run-server): Check return code * modules/ssh/dist/node.scm (node-run-server): Check return code of the executed command, throw a 'node-error' on a non-zero code. * AUTHORS, NEWS, THANKS: Update. --- AUTHORS | 4 +++- NEWS | 10 ++++++++++ THANKS | 1 + modules/ssh/dist/node.scm | 15 +++++++++------ 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/AUTHORS b/AUTHORS index 4fd0357..bc8fe0b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -55,4 +55,6 @@ See also files THANKS and ChangeLog. Bug reports, various comments and suggestions. * Mathieu - Pointed out to bugs in 'rrepl-get-result' from (ssh dist node). \ No newline at end of file + Pointed out to bugs in 'rrepl-get-result' from (ssh dist node). +* Marius Bakke + Pointed out to buigs in 'node-run-server' from (ssh dist node). \ No newline at end of file diff --git a/NEWS b/NEWS index ddbfa35..3c246e4 100644 --- a/NEWS +++ b/NEWS @@ -7,6 +7,16 @@ Copyright (C) Artyom V. Poptsov are permitted in any medium without royalty provided the copyright notice and this notice are preserved. +* Unreleased +** Bugfixes +*** 'node-run-server' now checks for errors + When 'node-run-server' fails to start the server it would go down an + infinite loop. The procedure now checks if the RREPL server started + correctly and throws 'node-error' if it's not. + + Reported by Marius Bakke and Ludovic Courtès, in + + * Changes in version 0.11.2 (2017-06-18) ** Bugfixes *** Always reset the channel and sftp streams when closing ports diff --git a/THANKS b/THANKS index 4cbf399..4e5878b 100644 --- a/THANKS +++ b/THANKS @@ -13,6 +13,7 @@ through bug reports or patches: * Ludovic Courtès * SaffronSnail * Mathieu +* Marius Bakke Thank you. \ No newline at end of file diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm index 09ce794..9ff3750 100644 --- a/modules/ssh/dist/node.scm +++ b/modules/ssh/dist/node.scm @@ -349,13 +349,16 @@ listens on an expected port, return #f otherwise." (guile-up-and-running?)))))))) +(define %guile-listen-command "nohup guile --listen=~a 0<&- &>/dev/null") + (define (node-run-server node) - "Run a RREPL server on a NODE." - (open-remote-input-pipe (node-session node) - (format #f "nohup guile --listen=~a 0<&- &>/dev/null" - (node-repl-port node))) - (while (not (node-server-running? node)) - (usleep 100))) + "Run a RREPL server on a NODE. Throw 'node-error 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)) + (while (not (node-server-running? node)) + (usleep 100)))) (define (node-stop-server node) "Stop a RREPL server on a NODE." -- cgit v1.2.3