summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-04-30 05:49:07 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2017-04-30 05:49:07 +0300
commita4f37fb6683c332e09e597a6eb19d26f4005a08c (patch)
treecd70b3f5aaca076adbda50fccee2aeeea6c383f2
parenttests/tunnel.scm ("call-with-ssh-forward"): Wait for 1s before polling (diff)
downloadguile-ssh-a4f37fb6683c332e09e597a6eb19d26f4005a08c.tar.gz
node.scm (rrepl-get-result): Handle "unbound variable" errors
The procedure would always fail to read "unbound variable" errors properly, returning wrong result with only two values (current module name and current language name). Now this bug should be fixed. Reported by Mathieu, in <https://github.com/artyom-poptsov/guile-ssh/issues/3> * modules/ssh/dist/node.scm (rrepl-get-result): Handle "unbound variable" errors. * tests/dist.scm ("rrepl-get-result, unbound variable error"): New test case. * AUTHORS, NEWS: Update.
-rw-r--r--AUTHORS2
-rw-r--r--NEWS7
-rw-r--r--modules/ssh/dist/node.scm9
-rw-r--r--tests/dist.scm13
4 files changed, 29 insertions, 2 deletions
diff --git a/AUTHORS b/AUTHORS
index 9ba7293..ce65fd7 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,4 +24,4 @@ See also files THANKS and ChangeLog.
Bug reports, various comments and suggestions.
* Mathieu <https://github.com/mothacehe>
- Pointed out to a bug 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). \ No newline at end of file
diff --git a/NEWS b/NEWS
index f40eed7..1eef177 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,13 @@ Copyright (C) Artyom V. Poptsov <poptsov.artyom@gmail.com>
Reported by Mathieu, in
<https://github.com/artyom-poptsov/guile-ssh/issues/3>
+***** 'rrepl-get-result' now handles "unbound variable" errors
+ The procedure would always fail to read "unbound variable" errors
+ properly, returning wrong result with only two values (current module
+ name and current language name). Now this bug should be fixed.
+
+ Reported by Mathieu, in
+ <https://github.com/artyom-poptsov/guile-ssh/issues/3>
** Changes in (ssh dist node)
*** 'node-eval' now can work without procps
The procedure now checks if procps package is present on a node and uses
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 247dd88..5174714 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -182,6 +182,12 @@ error."
(define %repl-error-regexp-2
(make-regexp "^ERROR: .*"))
+;; Regexp for parsing "unbound variable" errors.
+(define %repl-error-unbound-variable
+ (make-regexp "socket:[0-9]+:[0-9]+: \
+In procedure module-lookup: Unbound variable: .*"))
+
+
(define (rrepl-get-result repl-channel)
"Get result of evaluation form REPL-CHANNEL, return four values: an
evaluation result, a number of the evaluation, a module name and a language
@@ -227,7 +233,8 @@ name. Throw 'node-repl-error' on an error."
(define (error? line)
"Does a LINE contain an REPL error message?"
(or (regexp-exec %repl-error-regexp line)
- (regexp-exec %repl-error-regexp-2 line)))
+ (regexp-exec %repl-error-regexp-2 line)
+ (regexp-exec %repl-error-unbound-variable line)))
(define (error-message? result)
"Does a RESULT of evaluation contains a REPL error message?"
diff --git a/tests/dist.scm b/tests/dist.scm
index 307a7bb..52206f4 100644
--- a/tests/dist.scm
+++ b/tests/dist.scm
@@ -133,6 +133,19 @@
"ERROR: no code for module (module-that-doesnt-exist)")
rrepl-get-result))
+(test-error-with-log/= "rrepl-get-result, unbound variable error"
+ 'node-repl-error "scheme@(guile-user)> ;;; socket:9:7: warning: \
+possibly unbound variable `e'\nsocket:9:7: In procedure #<procedure \
+1a44920 at socket:9:7 ()>:\nsocket:9:7: In procedure module-lookup: \
+Unbound variable: e"
+ (call-with-input-string
+ (string-append (string-append
+ "scheme@(guile-user)> ;;; socket:9:7: warning: "
+ "possibly unbound variable `e'\nsocket:9:7: "
+ "In procedure #<procedure 1a44920 at socket:9:7 ()>:\n"
+ "socket:9:7: In procedure module-lookup: Unbound variable: e"))
+ rrepl-get-result))
+
(test-assert "rrepl-get-result, elisp"
(receive (result eval-num module-name lang)
(call-with-input-string "elisp@(guile-user)> $0 = #nil"