diff options
| author | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2016-12-25 08:14:46 +0300 |
|---|---|---|
| committer | Artyom V. Poptsov <poptsov.artyom@gmail.com> | 2016-12-25 08:14:46 +0300 |
| commit | d6049e36ec319d2094d458d34dfc5d32bc8e1702 (patch) | |
| tree | 53c955f45c7083900d1fa7290c7173b8e01e1b4c /modules | |
| parent | shell.scm (rexec): Close a remote pipe after use (diff) | |
| download | guile-ssh-d6049e36ec319d2094d458d34dfc5d32bc8e1702.tar.gz | |
node.scm (node-stop-server): Use SIGKILL signal as the last resort
* modules/ssh/dist/node.scm (node-stop-server): Try to SIGTERM the RREPL
server first, then use SIGKILL signal. Add logging.
* modules/ssh/shell.scm (pkill): Allow to specify signal to send.
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/ssh/dist/node.scm | 9 | ||||
| -rw-r--r-- | modules/ssh/shell.scm | 6 |
2 files changed, 13 insertions, 2 deletions
diff --git a/modules/ssh/dist/node.scm b/modules/ssh/dist/node.scm index 7562902..a39934d 100644 --- a/modules/ssh/dist/node.scm +++ b/modules/ssh/dist/node.scm @@ -313,10 +313,19 @@ listens on an expected port, return #f otherwise." (define (node-stop-server node) "Stop a RREPL server on a NODE." + (format-log 'functions "[scm] node-stop-server" + "trying to SIGTERM the RREPL server on ~a ..." node) (pkill (node-session node) (format #f "guile --listen=~a" (node-repl-port node)) #:full? #t) (while (node-server-running? node) + (format-log 'functions "[scm] node-stop-server" + "trying to SIGKILL the RREPL server on ~a ..." + node) + (pkill (node-session node) + (format #f "guile --listen=~a" (node-repl-port node)) + #:signal 'SIGKILL + #:full? #t) (sleep 1))) diff --git a/modules/ssh/shell.scm b/modules/ssh/shell.scm index 1e21135..3ac3dc2 100644 --- a/modules/ssh/shell.scm +++ b/modules/ssh/shell.scm @@ -93,9 +93,11 @@ Return two values: a check result and a return code." (if full? "-f" "") pattern))) -(define* (pkill session pattern #:key (full? #f)) - (rexec session (format #f "pkill ~a '~a'" +(define* (pkill session pattern #:key (full? #f) + (signal 'SIGTERM)) + (rexec session (format #f "pkill ~a --signal ~a '~a'" (if full? "-f" "") + signal pattern))) (define (fallback-pgrep session pattern) |
