summaryrefslogtreecommitdiff
path: root/modules/ssh/dist
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-10-29 20:38:56 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2015-10-29 20:39:56 +0300
commit4592f6e9d31e0e9b3c4181af5728cd063ea3ed88 (patch)
treeda203ccc23251b06e810f050385442d02e520760 /modules/ssh/dist
parentnode.scm (eof-or-null?): New procedure (diff)
downloadguile-ssh-4592f6e9d31e0e9b3c4181af5728cd063ea3ed88.tar.gz
node.scm (read-string): New procedure
* modules/ssh/dist/node.scm (read-string): New procedure. (rrepl-get-result): Use it.
Diffstat (limited to 'modules/ssh/dist')
-rw-r--r--modules/ssh/dist/node.scm17
1 files changed, 8 insertions, 9 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 2d71683..507f577 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -129,6 +129,10 @@ automatically in case when it is not started yet."
;;; Remote REPL (RREPL)
+(define (read-string str)
+ "Read a string STR."
+ (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."
@@ -196,24 +200,19 @@ name. Throw 'node-repl-error' on an error."
(let ((len (length matches)))
(if (= len 1)
(let ((m (car matches)))
- (values (call-with-input-string (match:substring m 4)
- read)
+ (values (read-string (match:substring m 4))
(string->number (match:substring m 3))))
(let ((rv (make-vector len))
(nv (make-vector len)))
(vector-set! rv 0
- (call-with-input-string (match:substring (car matches)
- 4)
- read))
+ (read-string (match:substring (car matches) 4)))
(vector-set! nv 0
(string->number (match:substring (car matches) 3)))
(do ((i 1 (1+ i)))
((= i len))
(vector-set! rv i
- (call-with-input-string
- (match:substring (list-ref matches i)
- 2)
- read))
+ (read-string (match:substring (list-ref matches i)
+ 2)))
(vector-set! nv i
(string->number (match:substring (list-ref matches
i)