summaryrefslogtreecommitdiff
path: root/Remote
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2017-09-28 15:44:45 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2017-09-28 15:44:45 -0400
commit48cf675cff3dea1f295a76199429ba0be07a6d94 (patch)
treec3ccdd9a32f5986d73d3fcedf92d5a18867c5799 /Remote
parenta9f8f8336bbb141c238ba9c71d78de00d8d0091e (diff)
external crash fixes
When the external special remote program crashed, a newline could be output, which messed up the expected output for --batch mode. Avoid checking EXPORTSUPPORTED for special remotes that are not configured to use exports. The datalad special remote apparently is/was buggy and crashed on EXPORTSUPPORTED. Anyway, there's no need to send it when the configuration doesn't need it. This commit was supported by the NSF-funded DataLad project.
Diffstat (limited to 'Remote')
-rw-r--r--Remote/External.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Remote/External.hs b/Remote/External.hs
index 63f58204a..4220c47d7 100644
--- a/Remote/External.hs
+++ b/Remote/External.hs
@@ -20,6 +20,7 @@ import Git.Config (isTrue, boolConfig)
import Git.Env
import Remote.Helper.Special
import Remote.Helper.Export
+import Annex.Export
import Remote.Helper.ReadOnly
import Remote.Helper.Messages
import Utility.Metered
@@ -69,7 +70,9 @@ gen r u c gc
Annex.addCleanup (RemoteCleanup u) $ stopExternal external
cst <- getCost external r gc
avail <- getAvailability external r gc
- exportsupported <- checkExportSupported' external
+ exportsupported <- if exportTree c
+ then checkExportSupported' external
+ else return False
let exportactions = if exportsupported
then return $ ExportActions
{ storeExport = storeExportM external
@@ -165,8 +168,9 @@ checkExportSupported c gc = do
=<< newExternal externaltype NoUUID c gc
checkExportSupported' :: External -> Annex Bool
-checkExportSupported' external = safely $
- handleRequest external EXPORTSUPPORTED Nothing $ \resp -> case resp of
+checkExportSupported' external = go `catchNonAsync` (const (return False))
+ where
+ go = handleRequest external EXPORTSUPPORTED Nothing $ \resp -> case resp of
EXPORTSUPPORTED_SUCCESS -> Just $ return True
EXPORTSUPPORTED_FAILURE -> Just $ return False
UNSUPPORTED_REQUEST -> Just $ return False
@@ -313,7 +317,7 @@ safely a = go =<< tryNonAsync a
where
go (Right r) = return r
go (Left e) = do
- warning $ show e
+ toplevelWarning False (show e)
return False
{- Sends a Request to the external remote, and waits for it to generate