summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/ssh/dist/node.scm4
-rw-r--r--modules/ssh/shell.scm8
2 files changed, 8 insertions, 4 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index 2091aa1..e594904 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -262,9 +262,7 @@ result, a number of the evaluation, a module name and a language name. Throw
listens on an expected port, return #f otherwise."
(define (pgrep-available?)
"Check if 'pgrep' from procps is available on the node."
- (receive (result rc)
- (which (node-session node) "pgrep")
- (zero? rc)))
+ (command-available? (node-session node) "pgrep"))
(define (guile-up-and-running?)
(let ((rp (tunnel-open-forward-channel (node-tunnel node))))
(and (channel-open? rp)
diff --git a/modules/ssh/shell.scm b/modules/ssh/shell.scm
index 2b108ea..c36303d 100644
--- a/modules/ssh/shell.scm
+++ b/modules/ssh/shell.scm
@@ -39,7 +39,7 @@
#:use-module (ice-9 rdelim)
#:use-module (ssh channel)
#:use-module (ssh popen)
- #:export (rexec which pgrep fallback-pgrep))
+ #:export (rexec which pgrep fallback-pgrep command-available?))
;;;
@@ -105,4 +105,10 @@ Return two values: a check result and a return code."
"exit 1;"
"' | bash"))))
+(define (command-available? session command)
+ "check if COMMAND is available on a remote side."
+ (receive (result rc)
+ (which session command)
+ (zero? rc)))
+
;;; shell.scm ends here.