summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Command/Fsck.hs14
-rw-r--r--Remote/Rsync.hs20
-rw-r--r--Utility/Daemon.hs2
3 files changed, 10 insertions, 26 deletions
diff --git a/Command/Fsck.hs b/Command/Fsck.hs
index dfe1a9ab6..cdbb155c2 100644
--- a/Command/Fsck.hs
+++ b/Command/Fsck.hs
@@ -31,12 +31,8 @@ import Config
import Types.Key
import Utility.HumanTime
import Git.FilePath
+import Utility.PID
-#ifndef mingw32_HOST_OS
-import System.Posix.Process (getProcessID)
-#else
-import System.Win32.Process.Current (getCurrentProcessId)
-#endif
import Data.Time.Clock.POSIX
import Data.Time
import System.Posix.Types (EpochTime)
@@ -149,14 +145,10 @@ performRemote key file backend numcopies remote =
, checkKeyNumCopies key file numcopies
]
withtmp a = do
-#ifndef mingw32_HOST_OS
- v <- liftIO getProcessID
-#else
- v <- liftIO getCurrentProcessId
-#endif
+ pid <- liftIO getPID
t <- fromRepo gitAnnexTmpDir
createAnnexDirectory t
- let tmp = t </> "fsck" ++ show v ++ "." ++ keyFile key
+ let tmp = t </> "fsck" ++ show pid ++ "." ++ keyFile key
let cleanup = liftIO $ catchIO (removeFile tmp) (const noop)
cleanup
cleanup `after` a tmp
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index b543387c3..570725bcf 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -18,14 +18,6 @@ module Remote.Rsync (
RsyncOpts
) where
-import qualified Data.ByteString.Lazy as L
-import qualified Data.Map as M
-#ifndef mingw32_HOST_OS
-import System.Posix.Process (getProcessID)
-#else
-import System.Win32.Process.Current (getCurrentProcessId)
-#endif
-
import Common.Annex
import Types.Remote
import qualified Git
@@ -40,10 +32,14 @@ import Crypto
import Utility.Rsync
import Utility.CopyFile
import Utility.Metered
+import Utility.PID
import Annex.Perms
import Logs.Transfer
import Types.Creds
+import qualified Data.ByteString.Lazy as L
+import qualified Data.Map as M
+
type RsyncUrl = String
data RsyncOpts = RsyncOpts
@@ -250,14 +246,10 @@ sendParams = ifM crippledFileSystem
- up trees for rsync. -}
withRsyncScratchDir :: (FilePath -> Annex a) -> Annex a
withRsyncScratchDir a = do
-#ifndef mingw32_HOST_OS
- v <- liftIO getProcessID
-#else
- v <- liftIO getCurrentProcessId
-#endif
+ p <- liftIO getPID
t <- fromRepo gitAnnexTmpDir
createAnnexDirectory t
- let tmp = t </> "rsynctmp" </> show v
+ let tmp = t </> "rsynctmp" </> show p
nuke tmp
liftIO $ createDirectoryIfMissing True tmp
nuke tmp `after` a tmp
diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs
index 970f26c3e..a3a8dbb51 100644
--- a/Utility/Daemon.hs
+++ b/Utility/Daemon.hs
@@ -20,7 +20,7 @@ import System.Posix
import Control.Concurrent.Async
#else
import System.PosixCompat.Types
-import System.Win32.Console (generateConsoleCtrlEvent, cTRL_C_EVENT
+import System.Win32.Console (generateConsoleCtrlEvent, cTRL_C_EVENT)
#endif
#ifndef mingw32_HOST_OS