summaryrefslogtreecommitdiff
path: root/modules/ssh
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-06-12 10:00:13 +0400
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-06-12 10:00:13 +0400
commit31578708578e43de6e5acbdc630ca20a606e6970 (patch)
tree028dd482327c7942403bbb509e828a7400ca03fa /modules/ssh
parenttests/client-server.scm (make-session/channel-test): Improve (diff)
downloadguile-ssh-31578708578e43de6e5acbdc630ca20a606e6970.tar.gz
node.scm (rexec): Read all output lines
* modules/ssh/dist/node.scm (rexec): Read all output lines, return the list of lines. All callers updated. (node-guile-version): Update.
Diffstat (limited to 'modules/ssh')
-rw-r--r--modules/ssh/dist/node.scm14
1 files changed, 10 insertions, 4 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 3855028..eae6ddb 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -141,10 +141,16 @@ to #t then a REPL server will be stopped as soon as an evaluation is done."
(call-with-input-string str read))
(define (rexec node cmd)
- "Execute a command CMD on the remote side. Return two values: the first
-line returned by CMD and its exit code."
+ "Execute a command CMD on the remote side. Return two values: list of
+output lines returned by CMD and its exit code."
(let ((channel (open-remote-input-pipe (node-session node) cmd)))
- (values (read-line channel) (channel-get-exit-status channel))))
+ (values (let loop ((line (read-line channel))
+ (result '()))
+ (if (eof-or-null? line)
+ (reverse result)
+ (loop (read-line channel)
+ (cons line result))))
+ (channel-get-exit-status channel))))
(define (rrepl-skip-to-prompt repl-channel)
"Read from REPL-CHANNEL until REPL is observed. Throw 'node-error' on an
@@ -325,6 +331,6 @@ procedure returns the 1st evaluated value if multiple values were returned."
(receive (result rc)
(rexec node "which guile > /dev/null && guile --version")
(and (zero? rc)
- result)))
+ (car result))))
;;; node.scm ends here