diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-10-29 19:27:14 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2015-10-29 19:27:14 +0300 |
| commit | 3ab8e947e48dbc67dbaab39843c9cb496d12b4b7 (patch) | |
| tree | 568ffcd2e2c5e198b77e0062ee3ec21345a3bce2 /modules/ssh/dist | |
| parent | node.scm: Add comments to <node> fields (diff) | |
| download | guile-ssh-3ab8e947e48dbc67dbaab39843c9cb496d12b4b7.tar.gz | |
node.scm (eof-or-null?): New procedure
* modules/ssh/dist/node.scm (eof-or-null?): New procedure.
(rrepl-get-result): Use it.
Diffstat (limited to 'modules/ssh/dist')
| -rw-r--r-- | modules/ssh/dist/node.scm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm index 45bc60d..2d71683 100644 --- a/modules/ssh/dist/node.scm +++ b/modules/ssh/dist/node.scm @@ -74,6 +74,11 @@ rrepl-get-result)) +(define (eof-or-null? str) + "Return #t if a STR is an EOF object or an empty string, #f otherwise." + (or (eof-object? str) (string-null? str))) + + ;;; Error reporting (define (node-error . args) @@ -174,7 +179,7 @@ name. Throw 'node-repl-error' on an error." (define (raise-repl-error result) (let loop ((line (read-line repl-channel)) (result result)) - (if (or (eof-object? line) (string-null? line)) + (if (eof-or-null? line) (node-repl-error "Evaluation failed" result) (loop (read-line repl-channel) (string-append result "\n" line))))) @@ -183,7 +188,7 @@ name. Throw 'node-repl-error' on an error." (let ((matches (let loop ((line (read-line repl-channel)) (matches (list match))) - (if (or (eof-object? line) (string-null? line) + (if (or (eof-or-null? line) (regexp-exec %repl-undefined-result-regexp line)) (reverse matches) (loop (read-line repl-channel) |
