export CreateProcess fields from Utility.Process

update code to avoid cwd and env redefinition warnings
This commit is contained in:
Joey Hess 2014-06-10 19:20:14 -04:00
parent 6eb5e6c135
commit a44fd2c019
31 changed files with 458 additions and 480 deletions

View file

@ -122,15 +122,15 @@ installNautilus _ = noop
cleanEnvironment :: IO (Maybe [(String, String)])
cleanEnvironment = clean <$> getEnvironment
where
clean env
clean environ
| null vars = Nothing
| otherwise = Just $ catMaybes $ map (restoreorig env) env
| otherwise = Just $ catMaybes $ map (restoreorig environ) environ
| otherwise = Nothing
where
vars = words $ fromMaybe "" $
lookup "GIT_ANNEX_STANDLONE_ENV" env
restoreorig oldenv p@(k, _v)
| k `elem` vars = case lookup ("ORIG_" ++ k) oldenv of
lookup "GIT_ANNEX_STANDLONE_ENV" environ
restoreorig oldenviron p@(k, _v)
| k `elem` vars = case lookup ("ORIG_" ++ k) oldenviron of
(Just v')
| not (null v') -> Just (k, v')
_ -> Nothing

View file

@ -24,7 +24,6 @@ import qualified Annex
import qualified Git
import Control.Concurrent
import System.Process (cwd)
#ifndef mingw32_HOST_OS
import System.Posix (signalProcess, sigTERM)
#else

View file

@ -22,7 +22,6 @@ import qualified Types.Remote as Remote
import Control.Concurrent
import Control.Concurrent.Async
import System.Process (std_in, std_out)
import Network.URI
import qualified Data.Map as M
import qualified Data.Set as S

View file

@ -15,7 +15,6 @@ import Utility.Batch
import qualified Command.TransferKeys as T
import Control.Concurrent.STM hiding (check)
import System.Process (create_group, std_in, std_out)
import Control.Exception (throw)
import Control.Concurrent

View file

@ -116,11 +116,11 @@ defaultRepositoryPath :: Bool -> IO FilePath
defaultRepositoryPath firstrun = do
#ifndef mingw32_HOST_OS
home <- myHomeDir
cwd <- liftIO getCurrentDirectory
if home == cwd && firstrun
currdir <- liftIO getCurrentDirectory
if home == currdir && firstrun
then inhome
else ifM (legit cwd <&&> canWrite cwd)
( return cwd
else ifM (legit currdir <&&> canWrite currdir)
( return currdir
, inhome
)
#else

View file

@ -381,7 +381,7 @@ sshAuthTranscript sshinput opts input = case inputAuthMethod sshinput of
login = getLogin sshinput
geti f = maybe "" T.unpack (f sshinput)
go extraopts env = processTranscript' "ssh" (extraopts ++ opts) env $
go extraopts environ = processTranscript' "ssh" (extraopts ++ opts) environ $
Just (fromMaybe "" input)
setupAskPass = do
@ -392,8 +392,8 @@ sshAuthTranscript sshinput opts input = case inputAuthMethod sshinput of
Just pass -> withTmpFile "ssh" $ \passfile h -> do
hClose h
writeFileProtected passfile pass
env <- getEnvironment
let env' = addEntries
environ <- getEnvironment
let environ' = addEntries
[ ("SSH_ASKPASS", program)
, (sshAskPassEnv, passfile)
-- ssh does not use SSH_ASKPASS
@ -401,8 +401,8 @@ sshAuthTranscript sshinput opts input = case inputAuthMethod sshinput of
-- there is no controlling
-- terminal.
, ("DISPLAY", ":0")
] env
go [passwordprompts 1] (Just env')
] environ
go [passwordprompts 1] (Just environ')
passwordprompts :: Int -> String
passwordprompts = sshOpt "NumberOfPasswordPrompts" . show

View file

@ -38,7 +38,6 @@ import Utility.Env
import Network.Protocol.XMPP
import qualified Data.Text as T
import System.Posix.Types
import System.Process (std_in, std_out, std_err)
import Control.Concurrent
import System.Timeout
import qualified Data.ByteString as B
@ -112,15 +111,15 @@ xmppPush cid gitpush = do
tmpdir <- gettmpdir
installwrapper tmpdir
env <- liftIO getEnvironment
environ <- liftIO getEnvironment
path <- liftIO getSearchPath
let myenv = addEntries
let myenviron = addEntries
[ ("PATH", intercalate [searchPathSeparator] $ tmpdir:path)
, (relayIn, show inf)
, (relayOut, show outf)
, (relayControl, show controlf)
]
env
environ
inh <- liftIO $ fdToHandle readpush
outh <- liftIO $ fdToHandle writepush
@ -132,7 +131,7 @@ xmppPush cid gitpush = do
{- This can take a long time to run, so avoid running it in the
- Annex monad. Also, override environment. -}
g <- liftAnnex gitRepo
r <- liftIO $ gitpush $ g { gitEnv = Just myenv }
r <- liftIO $ gitpush $ g { gitEnv = Just myenviron }
liftIO $ do
mapM_ killThread [t1, t2]