summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-25 10:48:51 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-25 10:48:51 +0300
commita3430f8ae9be2ca46b2b4f302d2d5ed8ae3b223a (patch)
treeb8cc6fc330862cd54fced32dcdd31a8053bc333b /modules
parentshell.scm (fallback-pkill): New procedure (diff)
downloadguile-ssh-a3430f8ae9be2ca46b2b4f302d2d5ed8ae3b223a.tar.gz
node.scm (procps-available?): New procedure
* modules/ssh/dist/node.scm (procps-available?): New procedure. (node-server-running?, node-stop-server): Use it.
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/dist/node.scm14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 340b41f..8bcfdf7 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -257,12 +257,14 @@ result, a number of the evaluation, a module name and a language name. Throw
;;;
+(define (procps-available? node)
+ "Check if procps is available on a NODE."
+ (command-available? (node-session node) "pgrep"))
+
+
(define (node-server-running? node)
"Check if a RREPL is running on a NODE, return #t if it is running and
listens on an expected port, return #f otherwise."
- (define (pgrep-available?)
- "Check if 'pgrep' from procps is available on the node."
- (command-available? (node-session node) "pgrep"))
(define (guile-up-and-running?)
(let ((rp (tunnel-open-forward-channel (node-tunnel node))))
(and (channel-open? rp)
@@ -271,7 +273,7 @@ listens on an expected port, return #f otherwise."
(and (not (eof-object? line))
(string-match "^GNU Guile .*" line))))))
- (let ((pgrep? (pgrep-available?)))
+ (let ((pgrep? (procps-available? node)))
(unless pgrep?
(format-log 'rare
"node-server-running?"
@@ -313,11 +315,9 @@ listens on an expected port, return #f otherwise."
(define (node-stop-server node)
"Stop a RREPL server on a NODE."
- (define (pkill-available?)
- (command-available? (node-session node) "pkill"))
(format-log 'functions "[scm] node-stop-server"
"trying to SIGTERM the RREPL server on ~a ..." node)
- (let* ((pkill? (pkill-available?))
+ (let* ((pkill? (procps-available? node))
(pkill (if pkill? pkill fallback-pkill)))
(unless pkill?
(format-log 'rare