remove uses of warningIO

It's not concurrent-output safe, and doesn't support
--json-error-messages.

Using Annex.makeRunner is a bit scary, because what if it's run in a
different thread from an active annex action? Normally the same Annex
state is not used concurrently in several threads, and it's not designed
to be fully concurrency safe. (Annex.Concurrent exists to deal with
that.) I think it will be ok in these simple cases though. Eg,
when buffering a warning message to json, Annex.changeState is used,
and it modifies the MVar in a concurrency safe way.

The only warningIO remaining is not a problem.
This commit is contained in:
Joey Hess 2020-12-02 14:57:43 -04:00
parent 1858b65d88
commit 63839532c9
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 28 additions and 22 deletions

View file

@ -252,7 +252,8 @@ probeLockSupport = return True
probeLockSupport = withEventuallyCleanedOtherTmp $ \tmp -> do
let f = tmp P.</> "lockprobe"
mode <- annexFileMode
liftIO $ withAsync warnstall (const (go f mode))
annexrunner <- Annex.makeRunner
liftIO $ withAsync (warnstall annexrunner) (const (go f mode))
where
go f mode = do
removeWhenExistsWith R.removeLink f
@ -264,10 +265,11 @@ probeLockSupport = withEventuallyCleanedOtherTmp $ \tmp -> do
removeWhenExistsWith R.removeLink f
return ok
warnstall = do
warnstall annexrunner = do
threadDelaySeconds (Seconds 10)
warningIO "Probing the filesystem for POSIX fcntl lock support is taking a long time."
warningIO "(Setting annex.pidlock will avoid this probe.)"
annexrunner $ do
warning "Probing the filesystem for POSIX fcntl lock support is taking a long time."
warning "(Setting annex.pidlock will avoid this probe.)"
#endif
probeFifoSupport :: Annex Bool