summaryrefslogtreecommitdiff
path: root/Assistant/WebApp/DashBoard.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Assistant/WebApp/DashBoard.hs')
-rw-r--r--Assistant/WebApp/DashBoard.hs11
1 files changed, 8 insertions, 3 deletions
diff --git a/Assistant/WebApp/DashBoard.hs b/Assistant/WebApp/DashBoard.hs
index a04861ed6..e2245bf6c 100644
--- a/Assistant/WebApp/DashBoard.hs
+++ b/Assistant/WebApp/DashBoard.hs
@@ -29,7 +29,8 @@ import Yesod
import Text.Hamlet
import qualified Data.Map as M
import Control.Concurrent
-import System.Posix.Signals (signalProcess, sigTERM, sigKILL)
+import System.Posix.Signals (signalProcessGroup, sigTERM, sigKILL)
+import System.Posix.Process (getProcessGroupIDOf)
{- A display of currently running and queued transfers.
-
@@ -180,7 +181,11 @@ cancelTransfer t = do
maybe noop killThread $ transferTid info
maybe noop killproc $ transferPid info
removeTransfer (daemonStatus webapp) t
+ {- In order to stop helper processes like rsync,
+ - kill the whole process group of the process running the
+ - transfer. -}
killproc pid = do
- void $ tryIO $ signalProcess sigTERM pid
+ g <- getProcessGroupIDOf pid
+ void $ tryIO $ signalProcessGroup sigTERM g
threadDelay 100000 -- 0.1 second grace period
- void $ tryIO $ signalProcess sigKILL pid
+ void $ tryIO $ signalProcessGroup sigKILL g