summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-12-31 16:08:31 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-12-31 16:36:39 -0400
commit8f3134e5408ea1ea6207028ae17f2b5fb84e0c65 (patch)
tree99739954cd6b8a3c229a230f005d69f6ed74fb8c /Annex
parent6f83a6c8f45d7aa325d315654c4fd28de9feb4a6 (diff)
finally really add back custom-setup stanza
Fourth or fifth try at this and finally found a way to make it work. Absurd amount of busy-work forced on me by change in cabal's behavior. Split up Utility modules that need posix stuff out of ones used by Setup. Various other hacks around inability for Setup to use anything that ifdefs a use of unix. Probably lost a full day of my life to this. This is how build systems make their users hate them. Just saying.
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Action.hs18
-rw-r--r--Annex/AdjustedBranch.hs2
-rw-r--r--Annex/Branch.hs1
-rw-r--r--Annex/Common.hs5
-rw-r--r--Annex/Environment.hs2
-rw-r--r--Annex/Journal.hs1
-rw-r--r--Annex/MakeRepo.hs1
-rw-r--r--Annex/ReplaceFile.hs3
-rw-r--r--Annex/Ssh.hs1
-rw-r--r--Annex/YoutubeDl.hs1
10 files changed, 32 insertions, 3 deletions
diff --git a/Annex/Action.hs b/Annex/Action.hs
index fc8be6c91..273c62fa8 100644
--- a/Annex/Action.hs
+++ b/Annex/Action.hs
@@ -12,6 +12,8 @@ module Annex.Action where
import qualified Data.Map as M
#ifndef mingw32_HOST_OS
import System.Posix.Signals
+import System.Posix.Process (getAnyProcessStatus)
+import Utility.Exception
#endif
import Annex.Common
@@ -46,3 +48,19 @@ stopCoProcesses = do
checkAttrStop
hashObjectStop
checkIgnoreStop
+
+{- Reaps any zombie processes that may be hanging around.
+ -
+ - Warning: Not thread safe. Anything that was expecting to wait
+ - on a process and get back an exit status is going to be confused
+ - if this reap gets there first. -}
+reapZombies :: IO ()
+#ifndef mingw32_HOST_OS
+reapZombies =
+ -- throws an exception when there are no child processes
+ catchDefaultIO Nothing (getAnyProcessStatus False True)
+ >>= maybe (return ()) (const reapZombies)
+
+#else
+reapZombies = return ()
+#endif
diff --git a/Annex/AdjustedBranch.hs b/Annex/AdjustedBranch.hs
index 1ffc54f66..4bf1b631b 100644
--- a/Annex/AdjustedBranch.hs
+++ b/Annex/AdjustedBranch.hs
@@ -50,7 +50,7 @@ import Annex.AutoMerge
import Annex.Content
import Annex.Perms
import Annex.GitOverlay
-import Utility.Tmp
+import Utility.Tmp.Dir
import Utility.CopyFile
import qualified Database.Keys
import Config
diff --git a/Annex/Branch.hs b/Annex/Branch.hs
index 0dc360c54..6cb279702 100644
--- a/Annex/Branch.hs
+++ b/Annex/Branch.hs
@@ -65,6 +65,7 @@ import Annex.Branch.Transitions
import qualified Annex
import Annex.Hook
import Utility.FileSystemEncoding
+import Utility.Directory.Stream
{- Name of the branch that is used to store git-annex's information. -}
name :: Git.Ref
diff --git a/Annex/Common.hs b/Annex/Common.hs
index 52a545a59..bb277df7d 100644
--- a/Annex/Common.hs
+++ b/Annex/Common.hs
@@ -1,3 +1,5 @@
+{-# LANGUAGE CPP #-}
+
module Annex.Common (module X) where
import Common as X
@@ -7,3 +9,6 @@ import Types.UUID as X
import Annex as X (gitRepo, inRepo, fromRepo, calcRepo)
import Annex.Locations as X
import Messages as X
+#ifndef mingw32_HOST_OS
+import System.Posix.IO as X hiding (createPipe)
+#endif
diff --git a/Annex/Environment.hs b/Annex/Environment.hs
index 4f0fda986..6fdac1e49 100644
--- a/Annex/Environment.hs
+++ b/Annex/Environment.hs
@@ -13,7 +13,7 @@ import Annex.Common
import Utility.UserInfo
import qualified Git.Config
import Config
-import Utility.Env
+import Utility.Env.Set
{- Checks that the system's environment allows git to function.
- Git requires a GECOS username, or suitable git configuration, or
diff --git a/Annex/Journal.hs b/Annex/Journal.hs
index 184bb0ab0..0ff95ffe5 100644
--- a/Annex/Journal.hs
+++ b/Annex/Journal.hs
@@ -17,6 +17,7 @@ import Annex.Common
import qualified Git
import Annex.Perms
import Annex.LockFile
+import Utility.Directory.Stream
{- Records content for a file in the branch to the journal.
-
diff --git a/Annex/MakeRepo.hs b/Annex/MakeRepo.hs
index ac25c013d..189e98c7d 100644
--- a/Annex/MakeRepo.hs
+++ b/Annex/MakeRepo.hs
@@ -20,6 +20,7 @@ import Annex.Action
import Types.StandardGroups
import Logs.PreferredContent
import qualified Annex.Branch
+import Utility.Process.Transcript
{- Makes a new git repository. Or, if a git repository already
- exists, returns False. -}
diff --git a/Annex/ReplaceFile.hs b/Annex/ReplaceFile.hs
index 7cb4fbdea..06dfdf59e 100644
--- a/Annex/ReplaceFile.hs
+++ b/Annex/ReplaceFile.hs
@@ -11,7 +11,8 @@ module Annex.ReplaceFile where
import Annex.Common
import Annex.Perms
-import Utility.Tmp
+import Utility.Tmp.Dir
+import Utility.Path.Max
{- Replaces a possibly already existing file with a new version,
- atomically, by running an action.
diff --git a/Annex/Ssh.hs b/Annex/Ssh.hs
index 5154a50a4..7280b58a4 100644
--- a/Annex/Ssh.hs
+++ b/Annex/Ssh.hs
@@ -34,6 +34,7 @@ import Annex.Path
import Utility.Env
import Utility.FileSystemEncoding
import Utility.Hash
+import Utility.Process.Transcript
import Types.CleanupActions
import Types.Concurrency
import Git.Env
diff --git a/Annex/YoutubeDl.hs b/Annex/YoutubeDl.hs
index 95b6bf762..f49fb3307 100644
--- a/Annex/YoutubeDl.hs
+++ b/Annex/YoutubeDl.hs
@@ -21,6 +21,7 @@ import Annex.Url
import Utility.Url (URLString)
import Utility.DiskFree
import Utility.HtmlDetect
+import Utility.Process.Transcript
import Logs.Transfer
import Network.URI