propagate signals to the transferrer process group

Done on unix, could not implement it on windows quite.

The signal library gets part of the way needed for windows.
But I had to open https://github.com/pmlodawski/signal/issues/1 because
it lacks raiseSignal.

Also, I don't know what the equivilant of getProcessGroupIDOf is on
windows. And System.Process does not provide a way to send any signal to
a process group except for SIGINT.

This commit was sponsored by Boyd Stephen Smith Jr. on Patreon.
This commit is contained in:
Joey Hess 2020-12-11 15:28:58 -04:00
parent 79c765b727
commit d3f78da0ed
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
17 changed files with 150 additions and 48 deletions

View file

@ -181,7 +181,7 @@ tmpTorrentFile u = fromRepo . gitAnnexTmpObjectLocation =<< torrentUrlKey u
- torrent file once.
-}
registerTorrentCleanup :: URLString -> Annex ()
registerTorrentCleanup u = Annex.addCleanup (TorrentCleanup u) $
registerTorrentCleanup u = Annex.addCleanupAction (TorrentCleanup u) $
liftIO . removeWhenExistsWith R.removeLink =<< tmpTorrentFile u
{- Downloads the torrent file. (Not its contents.) -}

View file

@ -81,7 +81,7 @@ gen r u rc gc rs
| otherwise = do
c <- parsedRemoteConfig remote rc
external <- newExternal externaltype (Just u) c (Just gc) (Just rs)
Annex.addCleanup (RemoteCleanup u) $ stopExternal external
Annex.addCleanupAction (RemoteCleanup u) $ stopExternal external
cst <- getCost external r gc
avail <- getAvailability external r gc
exportsupported <- if exportTree c

View file

@ -832,7 +832,7 @@ rsyncOrCopyFile st rsyncparams src dest p =
commitOnCleanup :: Git.Repo -> Remote -> State -> Annex a -> Annex a
commitOnCleanup repo r st a = go `after` a
where
go = Annex.addCleanup (RemoteCleanup $ uuid r) cleanup
go = Annex.addCleanupAction (RemoteCleanup $ uuid r) cleanup
cleanup
| not $ Git.repoIsUrl repo = onLocalFast st $
doQuietSideAction $

View file

@ -76,7 +76,7 @@ runHooks r starthook stophook a = do
-- So, requiring idempotency is the right approach.
run starthook
Annex.addCleanup (StopHook $ uuid r) $ runstop lck
Annex.addCleanupAction (StopHook $ uuid r) $ runstop lck
runstop lck = do
-- Drop any shared lock we have, and take an
-- exclusive lock, without blocking. If the lock