This can be used by an external special remote to let a single process
perform concurrent actions, rather than multiple processes being
started, when that is more efficient.
+ * Display warning when external special remote does not start up
+ properly, or is not usable.
-- Joey Hess <id@joeyh.name> Fri, 14 Aug 2020 14:57:45 -0400
Nothing -> case parseMessage s :: Maybe ExceptionalMessage of
Just msg -> maybe (protocolError True s) id (handleexceptional msg)
Nothing -> protocolError False s
- protocolError parsed s = giveup $ "external special remote protocol error, unexpectedly received \"" ++ s ++ "\" " ++
- if parsed
- then "(command not allowed at this time)"
- else "(unable to parse command)"
+ protocolError parsed s = do
+ warning $ "external special remote protocol error, unexpectedly received \"" ++ s ++ "\" " ++
+ if parsed
+ then "(command not allowed at this time)"
+ else "(unable to parse command)"
+ giveup "unable to use special remote due to protocol error"
{- While the action is running, the ExternalState provided to it will not
- be available to any other calls.
writeTVar (externalLastPid external) n
return n
AddonProcess.startExternalAddonProcess basecmd pid >>= \case
- Left (AddonProcess.ProgramFailure err) -> giveup err
+ Left (AddonProcess.ProgramFailure err) -> do
+ unusable err
Left (AddonProcess.ProgramNotInstalled err) ->
case (lookupName (unparsedRemoteConfig (externalDefaultConfig external)), remoteAnnexReadOnly <$> externalGitConfig external) of
- (Just rname, Just True) -> giveup $ unlines
+ (Just rname, Just True) -> unusable $ unlines
[ err
, "This remote has annex-readonly=true, and previous versions of"
, "git-annex would tried to download from it without"
, "installing " ++ basecmd ++ ". If you want that, you need to set:"
, "git config remote." ++ rname ++ ".annex-externaltype readonly"
]
- _ -> giveup err
+ _ -> unusable err
Right p -> do
cv <- liftIO $ newTMVarIO $ externalDefaultConfig external
ccv <- liftIO $ newTMVarIO id
(const Nothing)
case filter (`notElem` fromExtensionList supportedExtensionList) (fromExtensionList exwanted) of
[] -> return exwanted
- exrest -> giveup $ unwords $
+ exrest -> unusable $ unwords $
[ basecmd
, "requested extensions that this version of git-annex does not support:"
] ++ exrest
+ unusable msg = do
+ warning msg
+ giveup ("unable to use external special remote " ++ basecmd)
+
stopExternal :: External -> Annex ()
stopExternal external = liftIO $ do
l <- atomically $ swapTVar (externalState external) []