diff --git a/R/BackendRserve.R b/R/BackendRserve.R index c736ba7..3139069 100644 --- a/R/BackendRserve.R +++ b/R/BackendRserve.R @@ -330,7 +330,7 @@ BackendRserve = R6::R6Class( #' @title Creates ApplicationProcess object #' #' @description -#' Creates ApplicationProcess to hold PID of the runnung applicaiton. +#' Creates ApplicationProcess to hold PID of the running application. #' ApplicationProcess = R6::R6Class( classname = "ApplicationProcess", @@ -345,12 +345,12 @@ ApplicationProcess = R6::R6Class( }, #' @description #' Send signal to process. - #' @param signal Singal code. + #' @param signal Signal code. kill = function(signal = 15L) { - # kill service - tools::pskill(self$pid, signal) - # kill childs - system(sprintf("pkill -%s -P %s", signal, self$pid), wait = FALSE) + # get childs + child_pids <- suppressWarnings(system(sprintf("pgrep -P %s", self$pid), intern = TRUE)) + # kill all + tools::pskill(c(self$pid, child_pids), signal) } ) )