convert to withCreateProcess for async exception safety
Not yet 100% done, so far I've grepped for waitForProcess and converted everything that uses that to start the process with withCreateProcess. Except for some things like P2P.IO and Assistant.TransferrerPool, and Utility.CoProcess, that manage a pool of processes. See #2 in https://git-annex.branchable.com/todo/more_extensive_retries_to_mask_transient_failures/#comment-209f8a8c38e63fb3a704e1282cb269c7 for how those will need to be dealt with. checkSuccessProcess, ignoreFailureProcess, and forceSuccessProcess calls waitForProcess, so callers of them will also need to be dealt with, and have not been yet.
This commit is contained in:
parent
1ee5919d1e
commit
92f775eba0
9 changed files with 68 additions and 65 deletions
|
@ -220,14 +220,15 @@ openBrowser' mcmd htmlshim realurl outh errh =
|
|||
hPutStrLn (fromMaybe stdout outh) $ "Launching web browser on " ++ url
|
||||
hFlush stdout
|
||||
environ <- cleanEnvironment
|
||||
(_, _, _, pid) <- createProcess p
|
||||
let p' = p
|
||||
{ env = environ
|
||||
, std_out = maybe Inherit UseHandle outh
|
||||
, std_err = maybe Inherit UseHandle errh
|
||||
}
|
||||
exitcode <- waitForProcess pid
|
||||
unless (exitcode == ExitSuccess) $
|
||||
hPutStrLn (fromMaybe stderr errh) "failed to start web browser"
|
||||
withCreateProcess p' $ \_ _ _ pid -> do
|
||||
exitcode <- waitForProcess pid
|
||||
unless (exitcode == ExitSuccess) $
|
||||
hPutStrLn (fromMaybe stderr errh) "failed to start web browser"
|
||||
|
||||
{- web.browser is a generic git config setting for a web browser program -}
|
||||
webBrowser :: Git.Repo -> Maybe FilePath
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue