summaryrefslogtreecommitdiff
path: root/modules/ssh
diff options
context:
space:
mode:
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-18 10:57:31 +0300
committerArtyom V. Poptsov <poptsov.artyom@gmail.com>2016-12-18 10:57:31 +0300
commit754231412ee4b81b893dfb30ad43bda4eeb748bd (patch)
tree0c126091d5c37877e9a6ee0fb4007c5bd59b3c12 /modules/ssh
parentshell.scm: Add missing (ice-9 receive) module (diff)
downloadguile-ssh-754231412ee4b81b893dfb30ad43bda4eeb748bd.tar.gz
shell.scm (pkill): New procedure
* modules/ssh/shell.scm (pkill): New procedure * modules/ssh/dist/node.scm (node-stop-server): Use it.
Diffstat (limited to 'modules/ssh')
-rw-r--r--modules/ssh/dist/node.scm6
-rw-r--r--modules/ssh/shell.scm7
2 files changed, 9 insertions, 4 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm
index e594904..af7fb71 100644
--- a/modules/ssh/dist/node.scm
+++ b/modules/ssh/dist/node.scm
@@ -313,9 +313,9 @@ listens on an expected port, return #f otherwise."
(define (node-stop-server node)
"Stop a RREPL server on a NODE."
- (close (open-remote-input-pipe (node-session node)
- (format #f "pkill --full 'guile --listen=~a'"
- (node-repl-port node))))
+ (pkill (node-session node)
+ (format #f "guile --listen=~a" (node-repl-port node))
+ #:full? #t)
(while (node-server-running? node)
(sleep 1)))
diff --git a/modules/ssh/shell.scm b/modules/ssh/shell.scm
index 6e10bb9..406230f 100644
--- a/modules/ssh/shell.scm
+++ b/modules/ssh/shell.scm
@@ -42,7 +42,7 @@
#:use-module (ice-9 receive)
#:use-module (ssh channel)
#:use-module (ssh popen)
- #:export (rexec which pgrep fallback-pgrep command-available?))
+ #:export (rexec which pgrep pkill fallback-pgrep command-available?))
;;;
@@ -84,6 +84,11 @@ Return two values: a check result and a return code."
(if full? "--full" "")
pattern)))
+(define* (pkill session pattern #:key (full? #f))
+ (rexec session (format #f "pkill ~a '~a'"
+ (if full? "--full" "")
+ pattern)))
+
(define (fallback-pgrep session pattern)
"Guile-SSH implementation of 'pgrep' that uses pure bash and '/proc'
filesystem. Check if a process with a PATTERN cmdline is available on a NODE.